[geotk] Convertion

Adrian Custer acuster at gmail.com
Thu Sep 17 08:59:56 EDT 2009


Hey,

The information is in the CRS coordiante system component which you can
see either by dumping out the CRS as Well Known Text (toString()) or by
using Martin's fabulous console tool 

    java -jar geotk-referencing....jar

or any geoTk jar bundle that includes referencing. See the website for
details or type help at the prompt.

Unlike the earlier advice given on the list, I highly discourage the
explicit use of considering the order of the axes. That is a hack that
will lead you astray and give you more long term hasstle. Instead, you
should add a transformation step in your work and let the rendering
system reorder your axes for you, instead of trying to second guess the
system. If you have CRS_A and want data in CRS_B, then ask the
referencing system for the transform and pass your coordinates through
that.

--adrian



On Thu, 2009-09-17 at 14:29 +0200, theuns wrote:
> Thanks for the very useful information Cedric.
> 
> Where can i get this definition information?
> For future purposes to check the what must come first.
> 
> Cédric Briançon wrote:
> > 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.
> > 
> > Cheers,
> > Cédric.
> > 
> > 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
> > >
> > >
> > >   
> > 
> 
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit



More information about the Geotoolkit mailing list