1

Using postgres (9.3.6) and postgis:

 select st_astext(st_transform(ST_GeomFromEWKT('SRID=3785;POINT( 7550310.77 4139679.02 )'), 4326));

This returns POINT(67.8255956454323 34.8217133646348)

Using scala and geotools (11.2 but I tried 13.0 as well):

val c = new Coordinate(7550310.77, 4139679.02)
val hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, true)
val crsAuthFactory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints)
val wgs84 = crsAuthFactory.createCoordinateReferenceSystem("EPSG:4326")
val webCRS = crsAuthFactory.createCoordinateReferenceSystem("EPSG:3785")
val webToWorldTransform = CRS.findMathTransform(webCRS, wgs84)
JTS.transform( c, null, webToWorldTransform )

This returns (67.82559564543232, 35.00213150097441)

The latitude seems to be shifted using geotools. Any advice? Am I missing something?

  • Normal practice seems to be to use cs2cs from proj4 as the truth reference. – BradHards Apr 1 '15 at 19:33
  • 2
    EPSG:3785 is a deprecated code. Try using 3857 instead. – Mintx Apr 1 '15 at 22:05
  • can you add which epsg module you are using? – Ian Turton Apr 2 '15 at 7:40
  • @Mintx this is just a toy example. I believe 3785 and 3857 use a completely different datum. The "real" data I have is in 3785 so just changing it to 3875 would make the data not valid? – Andrew Cassidy Apr 2 '15 at 16:42
  • @iant gt-epsg-hsql. Is that what your looking for? – Andrew Cassidy Apr 2 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.