0

I am trying to convert an N-triple RDF file which has geometries with WKT which use EPSG/3857 and I need to convert all WKTs to EPSG/4326 (I think it is the same as WGS84).

As a first step, I tried using cs2cs for one point, but the result was not a pair of numbers:

echo -75.137109 42.280707 | cs2cs +init=epsg:3857 +to +init=epsg:4326

0d0'2.43"W 0d0'1.367"N 0.000

Does anyone have a pointer for the proper use of cs2cs tool or some other utility or even a java function that I could include in my project?

  • Are you sure your values aren't already in latitude-longitude? – mkennedy Jun 14 '18 at 0:46
1

You can add the -f flag to control the output format:

$ echo -75.137109 42.280707 | cs2cs -f %f +init=epsg:3857 +to +init=epsg:4326 
-0.000675   0.000380 0.000000

Note that (-75,42) in epsg:3857 is 75 metres west and 42 metres north of where the equator hits the Greenwich meridian. So the output in lat-long is very near 0. The default output was "DMS" - degrees, minutes, and seconds.

With -f %f you convert the DMS to fractional degrees.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.