L-EST koordinaatide teisendusalgoritm PHP-s.

<?php

function L_EST($x,$y) {

// code by Argo Vilberg. argo@elavtoit.com, www.elavtoit.com";

// echo "Algpunkti geodeetilised koordinaadid";

$B=$x

$L=$y;

 

// echo "Projektsiooni parameetrid:";

// echo "Ristkoordinaatide alguspunti geodeetilised koordinaadid:";

 

$B0=57+31/60.0+3.19415/3600;

$L0=24;

 

// echo "Ristkoordinaatide alguspunkti ristkoordinaadid";

$X0=6375000.000;

$Y0=500000.000;

 

// echo "Koonuse lőikeparalleelid";

 

$B1=58;

$B2=59+20/60;

 

// echo "Ellipsoidi GRS 80 parameetrid";

$a=6378137;

$e=0.081819191;

 

$m1 = cos(deg2rad(58))/sqrt(1-pow($e,2)*pow(sin(deg2rad(58)),2));

 

$m2 = cos(deg2rad(59+1/3))/sqrt(1-pow($e,2)*pow(sin(deg2rad(59+1/3)),2));

 

$m = cos(deg2rad(58+5/60))/sqrt(1-pow($e,2)*pow(sin(deg2rad(58+5/60)),2));

 

$m = cos(deg2rad(58+5/60))/sqrt(1-pow($e,2)*pow(sin(deg2rad(58+5/60)),2));

 

$t1=tan(M_PI/4-deg2rad($B1/2))/pow(((1-$e*sin(deg2rad($B1)))/(1+$e*sin(deg2rad($B1)))),$e/2);

 

$t2=tan(M_PI/4-deg2rad($B2/2))/pow(((1-$e*sin(deg2rad($B2)))/(1+$e*sin(deg2rad($B2)))),$e/2);

 

$t0=tan(M_PI/4-deg2rad($B0/2))/pow(((1-$e*sin(deg2rad($B0)))/(1+$e*sin(deg2rad($B0)))),$e/2);

 

$t=tan(M_PI/4-deg2rad($B/2))/pow(((1-$e*sin(deg2rad($B)))/(1+$e*sin(deg2rad($B)))),$e/2);

 

$n=(log($m1)-log($m2))/(log($t1)-log($t2));

 

$F=$m1/($n*pow($t1,$n));

 

$p0=$a*$F*pow($t0,$n);

 

$p=$a*$F*pow($t,$n);

 

$Q=$n*deg2rad($L-$L0);

 

$X=$p0-$p*cos($Q)+$X0;

 

$Y=$p*sin($Q)+$Y0;

return array($X,$Y); }

 

?>

L-EST koordinaatide teisendusalgoritm JAVASCRIPTIS-s.

function L_EST(x,y) {

var B=x;

var L=y;

var B0=57+31/60.0+3.19415/3600;

var L0=24;

var X0=6375000.000;

var Y0=500000.000;

var B1=58;

var B2=59+20/60;

var a=6378137;

var e=0.081819191;

var M_PI=Math.PI;

var m1 = cos(deg2rad(58))/sqrt(1-pow(e,2)*pow(sin(deg2rad(58)),2));

var m2 = cos(deg2rad(59+1/3))/sqrt(1-pow(e,2)*pow(sin(deg2rad(59+1/3)),2));

var m = cos(deg2rad(58+5/60))/sqrt(1-pow(e,2)*pow(sin(deg2rad(58+5/60)),2));

var m = cos(deg2rad(58+5/60))/sqrt(1-pow(e,2)*pow(sin(deg2rad(58+5/60)),2));

var t1=tan(M_PI/4-deg2rad(B1/2))/pow(((1-e*sin(deg2rad(B1)))/(1+e*sin(deg2rad(B1)))),e/2);

var t2=tan(M_PI/4-deg2rad(B2/2))/pow(((1-e*sin(deg2rad(B2)))/(1+e*sin(deg2rad(B2)))),e/2);

var t0=tan(M_PI/4-deg2rad(B0/2))/pow(((1-e*sin(deg2rad(B0)))/(1+e*sin(deg2rad(B0)))),e/2);

var t=tan(M_PI/4-deg2rad(B/2))/pow(((1-e*sin(deg2rad(B)))/(1+e*sin(deg2rad(B)))),e/2);

var n=(log(m1)-log(m2))/(log(t1)-log(t2));

var F=m1/(n*pow(t1,n));

var p0=a*F*pow(t0,n);

var p=a*F*pow(t,n);

var Q=n*deg2rad(L-L0);

var X=Math.floor((p0-p*cos(Q)+X0)*100)/100;

var Y=Math.floor((p*sin(Q)+Y0)*100)/100;

var result = new Array(X,Y);

return result;

}