I'm using a postgis database and java to develop my application. I need to transform my geographic data currently in latitude/longitude format into a x/y format. I found solutions based on UTM coordinates, however points in different zones are a problem. I'm looking for a java library or a algorithm that does exactly this: http://www.whoi.edu/marine/ndsf/cgi-bin/NDSFutility.cgi?form=0&from=LatLon&to=XY

Given two lat/lon coordinates, one of them for origin, the output is x and y in meters. Thank you for your time


I assume your data are stored inside a postgis db. You can use postgis functions to do the transformations directly. No need for external libs

        st_x(st_transform(geom,<SRID>)) as X, 
        st_y(st_transform(geom,<srid>)) as Y 
  • missing closing brackets on each line there...
    – Theo F
    Jun 5 '20 at 17:54
  • 1
    thks, fixed it now
    – nickves
    Jun 6 '20 at 19:10

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.