1 |
package dk.thoerup.datumconversion; |
2 |
|
3 |
public class test { |
4 |
static void test() |
5 |
{ |
6 |
double Lat; |
7 |
double Long; |
8 |
double UTMEasting = 711375.0; |
9 |
double UTMNorthing = 6190309.0; |
10 |
String UTMZone = "32N"; |
11 |
int RefEllipsoid = 23;//WGS-84. See list with file "LatLong- UTM conversion.cpp" for id numbers |
12 |
|
13 |
Ll ll = DatumConverter.UTMtoLL(RefEllipsoid, new Utm(UTMNorthing, UTMEasting, UTMZone) ); |
14 |
System.out.println( "Calculated Lat, Long position(Lat, Long): " + (float)ll.lattitude + "," + (float)ll.longitude + "\n\n"); |
15 |
} |
16 |
|
17 |
|
18 |
public static void main(String [] args) |
19 |
{ |
20 |
test(); |
21 |
|
22 |
|
23 |
double Lat = 47.37816667; |
24 |
double Long = 8.23250000; |
25 |
double UTMNorthing; |
26 |
double UTMEasting; |
27 |
double SwissNorthing; |
28 |
double SwissEasting; |
29 |
String UTMZone; |
30 |
int RefEllipsoid = 23;//WGS-84. See list with file "LatLong- UTM conversion.cpp" for id numbers |
31 |
|
32 |
System.out.println( "Starting position(Lat, Long): " + Lat + " " + Long +"\n"); |
33 |
|
34 |
Utm utm = DatumConverter.LLtoUTM(RefEllipsoid, new Ll(Lat, Long)); |
35 |
|
36 |
UTMNorthing = utm.northing; |
37 |
UTMEasting = utm.easting; |
38 |
UTMZone = utm.utmZone; |
39 |
|
40 |
System.out.println( "Calculated UTM position(Northing, Easting, Zone): "); |
41 |
System.out.println( "" + UTMNorthing + " " + UTMEasting ); |
42 |
System.out.println(" " + UTMZone +"\n"); |
43 |
|
44 |
Ll ll = DatumConverter.UTMtoLL(RefEllipsoid, new Utm(UTMNorthing, UTMEasting, UTMZone)); |
45 |
Lat = ll.lattitude; |
46 |
Long = ll.longitude; |
47 |
System.out.println("Calculated Lat, Long position(Lat, Long): " + Lat + " " + Long + "\n\n"); |
48 |
|
49 |
Swiss swiss = DatumConverter.LLtoSwissGrid( Lat, Long); |
50 |
System.out.println("Calculated Swiss Grid position(Northing, Easting): "); |
51 |
System.out.println("" + swiss.Northing + " " + swiss.Easting + "\n"); |
52 |
|
53 |
} |
54 |
} |