program T17;
(*
Quelle:
http://crs.bkg.bund.de/crseu/crs/descrtrans/BeTA/de_dhdn2etrs_beta.php
*)
var
   i: integer;
   x,y: real;
   utmxZone: integer; 
   utmYZone: char; 
   easting, northing: real;
   z: integer;
begin
   WptsClear;
   WptsLoadCSV('TestPunkte.csv');

   Writeln('WGS84');
   Writeln('               Lat','             Lon');
   for i:=0 to WptsCount-1 do begin
      writeln(i+1:2,WptsLat(i):16:12,WptsLon(i):16:12)
   end;

   writeln;
   Writeln('Gauss Krüger');
   Writeln('                      X','               Y');
   for i:=0 to WptsCount-1 do begin
      z:=4;
      if WptsLon(i)<12 then begin
         z:= 3
      end;
      if WptsLon(i)<9 then begin
         z:= 2
      end;
      SetGKZone(Z);
      WGS84toGK(WptsLat(i),WptsLon(i),X,Y);
      Writeln(i+1:2,' GK',Z,' ',X:16:6,Y:16:6);
      Z:=z+1;
      SetGKZone(Z);
      WGS84toGK(WptsLat(i),WptsLon(i),X,Y);
      Writeln('   GK',Z,' ',X:16:6,Y:16:6)
   end;
   
   SetUtmXZone(32);
   writeln;
   Writeln('UTM XZone 32');
   Writeln('                    X','              Y');
   for i:=0 to WptsCount-1 do begin
      WGS84toUTM(WptsLat(i),WptsLon(i),utmxZone,utmYZone, easting, northing);
      Writeln(i+1:2,' ',utmYZone,utmxZone,easting:15:6, northing:15:6)
   end;

   SetUtmXZone(33);
   writeln;
   Writeln('UTM XZone 33');
   Writeln('                    X','              Y');
   for i:=13 to 29 do begin
      WGS84toUTM(WptsLat(i),WptsLon(i),utmxZone,utmYZone, easting, northing);
      Writeln(i+1:2,' ',utmYZone,utmxZone,easting:15:6, northing:15:6)
   end;
end.