Here is an algorithm to convert latitude & longitude (world
coordinates?) i.e. (lambda,phi) into Gauss-Krueger -coordinates
centered around some meridian (G-K centered to 27.0 are called
common coordinates or "artillery coordinates" in Finland, that
is set as Const into the code).
The code is Turbo Pascal and is an member function to class
LatLongCts, which is simply a record of x,y:Double. CommonCts
has same data as LatLongCts (is also a descendentant of the
DoublePoint). The result is in kilometers (XY.y is easting
from Merid and XY.x is northing from equator). The rest should
be clear from the code.
Ari Jolma (ajo...@hila.hut.fi)
---------------------------------------
The code starts from here:
---------------------------------------
Procedure LatLongCts.ConvertToCommonCts(Var XY:CommonCts);
(* Reference: Hirvonen 1972, Matemaattinen geodesia, TKY 305, Otaniemi p.31,67
original fortran algorithm by Y.Rauste 1985 *)
Type Array1_4OfDouble=Array [1..4] of Double;
Const Merid=27.0;
b:Array1_4OfDouble=(6367.65450006,-16.10703468,0.01697621,-0.00002227);
c=26399.93660810;
ep2=0.6768170197224E-2;
epsil=1.0E-12;
Var phi,lambda,vd,vd1,temp,phid,xp:Double;
EndLoop:Boolean;
i:Integer;
Begin
lambda:=Degr2Rad(y);
lambda:=lambda-Degr2Rad(Merid);
phi:=Degr2Rad(x);
vd1:=Sqrt(1+ep2*Sqr(Cos(phi)));
i:=1;EndLoop:=False;
While (i<1000) and not EndLoop do
begin
phid:=ArcTan(Tan(phi)/Cos(vd1*lambda));
vd:=Sqrt(1+ep2*Sqr(Cos(phid)));
EndLoop:=Abs(vd-vd1) <= epsil;
If not EndLoop then
begin
vd1:=vd;
Inc(i);
end;
end;
temp:=Tan(lambda)/vd*Cos(phid);
XY.y:=c*Log(temp+Sqrt(Sqr(temp)+1))+500;
XY.x:=b[1]*phid+b[2]*Sin(2*phid)+b[3]*Sin(4*phid)+b[4]*Sin(6*phid);
End;
Ari Jolma *
tel. 451 3831 *
ajo...@hila.hut.fi *
Building W, HUT, 02150 Espoo, Finland *