Hi,
I have this simple program that translates cords from "EPSG:4326" CRS to
"EPSG:32647". After I call transform on the MathTransform, coordinates
seem to be swapped:
Source cords:
[29218.758241851785 31026.134720284816,
29928.247176765635 31026.134720284816]
Are translated into target:
[0.2799344650738026, 94.7730230185235,
0.2799367749785255, 94.7793816575922]
So source x(29218.758241851785) is translated into target x
0.2799344650738026 which is latitude?
Could anybody point me to what I am doing wrong?
Regards,
Janusz
Simple program:
CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:4326");
CoordinateReferenceSystem sourceCrs = CRS.decode("EPSG:32647");
LineString ls = (LineString)new WKTReader().read("LINESTRING
(29218.758241851785 31026.134720284816, 29928.247176765635
31026.134720284816)");
Coordinate[] coords = ls.getCoordinates();
MathTransform mt1 = CRS.findMathTransform(sourceCrs, targetCrs);
double[] points = new
double[mt1.getSourceDimensions()*coords.length];
for(int i = 0; i < coords.length; i++) {
points[i*2] = coords[i].x;
points[i*2+1] = coords[i].y;
}
mt1.transform(points, 0, points, 0, coords.length);
GeodeticCalculator calc = new GeodeticCalculator(targetCrs);
calc.setStartingGeographicPoint(points[0], points[1]);
calc.setDestinationGeographicPoint(points[points.length-2],
points[points.length-1]);
double dist = calc.getOrthodromicDistance();
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users