????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.25 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/labs.astacus.se/ |
Upload File : |
<?php
function geodetic_to_grid($latitude,$longitude,$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);
$A = $e2;
$B = (5.0*$e2*$e2 - $e2*$e2*$e2) / 6.0;
$C = (104.0*$e2*$e2*$e2 - 45.0*$e2*$e2*$e2*$e2) / 120.0;
$D = (1237.0*$e2*$e2*$e2*$e2) / 1260.0;
$beta1 = $n/2.0 - 2.0*$n*$n/3.0 + 5.0*$n*$n*$n/16.0 + 41.0*$n*$n*$n*$n/180.0;
$beta2 = 13.0*$n*$n/48.0 - 3.0*$n*$n*$n/5.0 + 557.0*$n*$n*$n*$n/1440.0;
$beta3 = 61.0*$n*$n*$n/240.0 - 103.0*$n*$n*$n*$n/140.0;
$beta4 = 49561.0*$n*$n*$n*$n/161280.0;
# Convert.
$deg_to_rad = M_PI / 180.0;
$phi = $latitude * $deg_to_rad;
$lambda = $longitude * $deg_to_rad;
$lambda_zero = $central_meridian * $deg_to_rad;
$phi_star = $phi - sin($phi) * cos($phi) * ($A +
$B * pow(sin($phi), 2) +
$C * pow(sin($phi), 4) +
$D * pow(sin($phi), 6));
$delta_lambda = $lambda - $lambda_zero;
$xi_prim = atan(tan($phi_star) / cos($delta_lambda));
$eta_prim = atanh(cos($phi_star) * sin($delta_lambda));
$x = $scale * $a_roof * ($xi_prim +
$beta1 * sin(2.0*$xi_prim) * cosh(2.0*$eta_prim) +
$beta2 * sin(4.0*$xi_prim) * cosh(4.0*$eta_prim) +
$beta3 * sin(6.0*$xi_prim) * cosh(6.0*$eta_prim) +
$beta4 * sin(8.0*$xi_prim) * cosh(8.0*$eta_prim)) +
$false_northing;
$y = $scale * $a_roof * ($eta_prim +
$beta1 * cos(2.0*$xi_prim) * sinh(2.0*$eta_prim) +
$beta2 * cos(4.0*$xi_prim) * sinh(4.0*$eta_prim) +
$beta3 * cos(6.0*$xi_prim) * sinh(6.0*$eta_prim) +
$beta4 * cos(8.0*$xi_prim) * sinh(8.0*$eta_prim)) +
$false_easting;
//$x = ($x * 1000.0) / 1000.0;
//$y = ($y * 1000.0) / 1000.0;
$lat_lon[0] = $x;
$lat_lon[1] = $y;
return $lat_lon;
}
$v1 = geodetic_to_grid(-180,-90,15);
$v2 = geodetic_to_grid(58.441959,15.615088,15);
$Lat1 = $v1[0];
$Long1 = $v1[1];
$Lat2 = $v2[0];
$Long2 = $v2[1];
echo($Long1.",".$Lat1.",".$Long2.",".$Lat2);
?>