Hi all,
I am using geotools to convert coordinates for seismic data. I've never
had any issue before but this week I had to convert data using EPSG
22192 and got wrong results (my data is supposed to be onshore Argentina
and ended up close to the antartic).
Geotools does the following conversion (EPSG 22192 -> EPSG 4326)
x = 2572506.0 -> Lat = -57.53722563
y = 5757839.0 -> Lon = -38.73009392
The correct conversion (according to epsg.io
http://epsg.io/transform#s_srs=22192&t_srs=4326&x=2572506.0000000&y=5757839.0000000 should
be)
Transform coordinates - GPS online convertor
<http://epsg.io/transform#s_srs=22192&t_srs=4326&x=2572506.0000000&y=5757839.0000000>
Transform your coordinates online easily with epsg.io Transform
coordinates Online convertor for lat & long coordinates, geodetic datums
and projected systems
epsg.io
Lat = -38.328903
Lon = -68.1718113
After digging through the source code I found that WKT are defined (at
least) under
https://raw.githubusercontent.com/geotools/geotools/master/modules/plugin/epsg-wkt/src/main/resources/org/geotools/referencing/epsg/wkt/epsg.properties
I then compared it to the definition on https://epsg.io/22192 and found
different values.
Definition from Geotools:
PROJCS["Campo Inchauspe / Argentina 2",
GEOGCS["Campo Inchauspe",
DATUM["Campo Inchauspe",
SPHEROID["International 1924", 6378388.0, 297.0,
AUTHORITY["EPSG","7022"]],
TOWGS84[-154.5,150.7,100.4,0.0,0.0, 0.0,0.0],
AUTHORITY["EPSG","6221"]],
PRIMEM["Greenwich",0.0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.017453292519943295],
AXIS["Geodetic longitude",EAST],
AXIS["Geodetic latitude",NORTH],
AUTHORITY["EPSG","4221"]],
PROJECTION["Transverse_Mercator",
AUTHORITY["EPSG","9807"]],
PARAMETER["central_meridian", -69.0],
PARAMETER["latitude_of_origin",-90.0],
PARAMETER["scale_factor",1.0],
PARAMETER["false_easting",2500000.0],
PARAMETER["false_northing",0.0],
UNIT["m",1.0],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
AUTHORITY["EPSG","22192"]]
Definition from epsg.io:
PROJCS["Campo Inchauspe / Argentina 2",
GEOGCS["Campo Inchauspe",
DATUM["Campo_Inchauspe",
SPHEROID["International 1924",6378388,297,
AUTHORITY["EPSG","7022"]],
TOWGS84[-148,136,90,0,0,0,0],
AUTHORITY["EPSG","6221"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4221"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",-90],
PARAMETER["central_meridian",-69],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",2500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","22192"]]
I am not an expert in coordinate system. Would this difference be the
cause of my issue? If so, how can I fix this (scala code that depends on
geospark, a package that uses geotools)?
Is there anything in my code below (scala) that is wrong otherwise?
val sourceCRS = CRS.decode(s"EPSG:22192")
val targetCRS = CRS.decode(s"EPSG:4326")
val transform = CRS.findMathTransform(sourceCRS, targetCRS, true)
val cdp_x =2572506.0
val cdp_y = 5757839.0
val ptSrc = new DirectPosition2D(sourceCRS, cdp_x, cdp_y)
val ptDst = new DirectPosition2D()
transform.transform(ptSrc, ptDst)
println(ptDst.getCoordinate()(0))
println(ptDst.getCoordinate()(1))
Campo Inchauspe / Argentina 2 - EPSG:22192 <https://epsg.io/22192>
EPSG:22192 Projected coordinate system for Argentina - between 70°30'W
and 67°30'W, onshore. Large and medium scale topographic mapping and
engineering survey.
epsg.io
Thanks,
Julien Bluteau
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users