Reputation: 1
I'm developping an application with java whose permit to convert a EPSG:4326 point into EPSG:2972.
My code works :
//Grab a transform between two Coordinate Reference Systems
MathTransform mathTransform = CRS.findMathTransform("EPSG:4326","EPSG:2972", true);
//Point to convert
DirectPosition2D srcDirectPosition2D = new DirectPosition2D();
srcDirectPosition2D.setCoordinateReferenceSystem(CoordSysINT);
srcDirectPosition2D.setLocation(4.4665424,-52.4648442);
DirectPosition2D destDirectPosition2D = new DirectPosition2D();
//Transformation
mathTransform.transform(srcDirectPosition2D, destDirectPosition2D);
//Projected Point
ProjectedPoint=new Point(destDirectPosition2D.getX(), destDirectPosition2D.getY(),null);
The result is : X: 337473.6430296206 Y :493858.9919024287 but it is wrong.
If I use a website as http://cs2cs.mygeodata.eu/ and I do the same transformation, the true result is 337470.842698;493860.962631
The result of my code correspond to a a transformation between EPSG:4326 and EPSG : 32622 but I don't understand why ?
What is wrong in my code ?
Thanks a lot
Regards
Nicolas
Upvotes: 0
Views: 326
Reputation: 3576
The Proj.4 Text for EPSG:2972 is
+proj=utm +zone=22 +ellps=GRS80 +towgs84=2,2,-2,0,0,0,0 +units=m +no_defs
In Geotool, EPSG Database v8.6 shows the WKT for EPSG:2972 as
2972=PROJCS["RGFG95 / UTM zone 22N", GEOGCS["RGFG95", DATUM["Reseau Geodesique Francais Guyane 1995", SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], AUTHORITY["EPSG","6624"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4624"]], PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]], PARAMETER["central_meridian", -51.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["scale_factor", 0.9996], PARAMETER["false_easting", 500000.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","2972"]]
Note the highlighted toWGS84 conversion is different. This would explain the difference you are seeing. I don't know which is correct but I have a feeling that the EPSG WKT is wrong.
This difference changes the behaviour of EPSG:2972 to be like that of EPSG:32622. The more technical answer is that spheroid of the datum (GRS80) of EPSG:2972 is made to behave as if it were the spheroid of the datum (WGS84) of EPSG:32622
Upvotes: 1