[geotk] Convertion

Cédric Briançon cedric.briancon at geomatys.fr
Thu Sep 17 08:14:44 EDT 2009

Hi theuns,

the definition of the EPSG:4326 CRS specifies that the latitude comes 
first, and the longitude after. It is the opposite for the mercator 
projection EPSG:3395. This explains the inversion of coordinates you get 
in your DirectPosition object.

To fix that, you can for example use the crs "CRS:84", which is the same 
as "EPSG:4326", but with the longitude in first, or instead of doing: 
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
do: CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326", true);

The boolean will force the longitude axis in first, even if the CRS 
defines the contrary.


theuns a écrit :
> HI
> I pasted some code on http://pastebin.com/m44dfe63c 
> The problem i have is, i convert a coordinate in EPSG:3395 to EPSG:4326,
> but the result is turned around, by that i mean , i get the result as
> y,x instead of x,y.
> The input values is 
> GeneralDirectPosition(-7144442.991431108,-7277982.720580169)
> The ouput is a DirectPosition2D
> [-54.74691767204291, -64.17962335723159] = [y,x] and not [x,y] as i
> suspected?
> What am i doing wrong?
> Thanks
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit

More information about the Geotoolkit mailing list