[GIS] Converting latitude longitude coordinate to x y coordinate

coordinate systemjavapostgis

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.

Best Answer

I assume your data are stored inside a PostGIS database. You can use PostGIS functions to do the transformations directly. No need for external libraries.

    select 
        st_x(st_transform(geom,<SRID>)) as X, 
        st_y(st_transform(geom,<srid>)) as Y 
    from 
        mTable 
    where 
        ...