????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.217.114 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.supervision-online.se/login/ |
Upload File : |
<?php
// Conversion from grid coordinates to geodetic coordinates.
function grid_to_geodetic($x, $y, $central_meridian) {
$lat_lon[] = 2;
$axis = 6378137.0; // GRS 80.
$flattening = 1.0 / 298.257222101; // GRS 80.
$lat_of_origin = 0.0;
$scale = 1.0;
$false_northing = 0.0;
$false_easting = 150000.0;
// Prepare ellipsoid-based stuff.
$e2 = $flattening * (2.0 - $flattening);
$n = $flattening / (2.0 - $flattening);
$a_roof = $axis / (1.0 + $n) * (1.0 + $n*$n/4.0 + $n*$n*$n*$n/64.0);
$delta1 = $n/2.0 - 2.0*$n*$n/3.0 + 37.0*$n*$n*$n/96.0 - $n*$n*$n*$n/360.0;
$delta2 = $n*$n/48.0 + $n*$n*$n/15.0 - 437.0*$n*$n*$n*$n/1440.0;
$delta3 = 17.0*$n*$n*$n/480.0 - 37*$n*$n*$n*$n/840.0;
$delta4 = 4397.0*$n*$n*$n*$n/161280.0;
$Astar = $e2 + $e2*$e2 + $e2*$e2*$e2 + $e2*$e2*$e2*$e2;
$Bstar = -(7.0*$e2*$e2 + 17.0*$e2*$e2*$e2 + 30.0*$e2*$e2*$e2*$e2) / 6.0;
$Cstar = (224.0*$e2*$e2*$e2 + 889.0*$e2*$e2*$e2*$e2) / 120.0;
$Dstar = -(4279.0*$e2*$e2*$e2*$e2) / 1260.0;
// Convert.
$deg_to_rad = M_PI / 180;
$lambda_zero = $central_meridian * $deg_to_rad;
$xi = ($x - $false_northing) / ($scale * $a_roof);
$eta = ($y - $false_easting) / ($scale * $a_roof);
$xi_prim = $xi -
$delta1*sin(2.0*$xi) * cosh(2.0*$eta) -
$delta2*sin(4.0*$xi) * cosh(4.0*$eta) -
$delta3*sin(6.0*$xi) * cosh(6.0*$eta) -
$delta4*sin(8.0*$xi) * cosh(8.0*$eta);
$eta_prim = $eta -
$delta1*cos(2.0*$xi) * sinh(2.0*$eta) -
$delta2*cos(4.0*$xi) * sinh(4.0*$eta) -
$delta3*cos(6.0*$xi) * sinh(6.0*$eta) -
$delta4*cos(8.0*$xi) * sinh(8.0*$eta);
$phi_star = asin(sin($xi_prim) / cosh($eta_prim));
$delta_lambda = atan(sinh($eta_prim) / cos($xi_prim));
$lon_radian = $lambda_zero + $delta_lambda;
$lat_radian = $phi_star + sin($phi_star) * cos($phi_star) *
($Astar +
$Bstar*pow(sin($phi_star), 2) +
$Cstar*pow(sin($phi_star), 4) +
$Dstar*pow(sin($phi_star), 6));
$lat_lon[0] = $lat_radian * 180.0 / M_PI;
$lat_lon[1] = $lon_radian * 180.0 / M_PI;
//echo($lat_lon[0].",". $lat_lon[1]);
return $lat_lon;
}
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("supervision");
$x=1;
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>
';
$xml .= '<placemarks>
';
$sql = "SELECT * FROM tblPositions where companyid = 1";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$arr = grid_to_geodetic($row['long'],$row['lat'],15);
$xml .= ' <placemark>
';
$xml .= ' <id>'.$row['posid'].'</id>
';
$xml .= ' <label>'.$row['label'].'</label>
';
$xml .= ' <long>'.$arr[0].'</long>
';
$xml .= ' <lat>'.$arr[1].'</lat>
';
$xml .= ' <status>'.$row['status'].'</status>
';
$xml .= ' <description>Placemark $x'.$row['description'].'</description>
';
$xml .= ' </placemark>
';
$x++;
}
$xml .= '</placemarks>
';
echo($xml);
?>