Here is my test code:
public App(String latitude, String longitude, String height) {
lat = Double.parseDouble(latitude);
lon = Double.parseDouble(longitude);
this.height = Double.parseDouble(height);
double[] srcPts = {lon, lat, this.height};
double[] dstPts = new double[3];
try {
MathTransform toECEF = new
GeocentricTransform(DefaultEllipsoid.GRS80, true);
toECEF.transform(srcPts, 0, dstPts, 0, 1);
System.out.println("Latitude: " + srcPts[1]);
System.out.println("Longitude: " + srcPts[0]);
System.out.println("Height: " + srcPts[2]);
System.out.println("Xcentric toward prime meridian : " +
dstPts[0]);
System.out.println("Ycentric toward East: " + dstPts[1]);
System.out.println("Zcentric toward North: " + dstPts[2]);
System.out.println();
//inverse transform
MathTransform toGCS = toECEF.inverse();
toGCS.transform(dstPts,0,srcPts,0,1);
System.out.println("Latitude: " + srcPts[1]);
System.out.println("Longitude: " + srcPts[0]);
System.out.println("Height: " + srcPts[2]);
System.out.println("Xcentric toward prime meridian : " +
dstPts[0]);
System.out.println("Ycentric toward East: " + dstPts[1]);
System.out.println("Zcentric toward North: " + dstPts[2]);
} catch (TransformException e) {
e.printStackTrace();
}
}
Test result:
Latitude: 43.301
Longitude: -77.626667
Height: 0.0
Xcentric toward prime meridian : 996208.9809235458
Ycentric toward East: -4541094.921570469
Zcentric toward North: 4351898.060411415
Latitude: 43.301000041646724
Longitude: -77.62666700000001
Height: 0.0043603163212537766
Xcentric toward prime meridian : 996208.9809235458
Ycentric toward East: -4541094.921570469
Zcentric toward North: 4351898.060411415
Note that the height return from inverse transform is 4mm different from the
input height.
--
View this message in context:
http://n2.nabble.com/gt-referencing-questions-from-a-newbie-tp4294766p4393835.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users