There is an equals ignore metadata trick that can just compare the CRS
values (and will consider them equal even if some of the names are
different).

http://docs.geotools.org/stable/userguide/library/referencing/compare.html

Jody Garnett


On Tue, Jul 22, 2014 at 3:01 PM, Gabriella Turek <gabriella.tu...@niwa.co.nz
> wrote:

>  I am asking because I just realised the following
>
>   CoordinateReferenceSystem crs1 = CRS.decode("EPSG:27200");
>
> CoordinateReferenceSystem crs2 = CRS.decode("EPSG:27200");
>
> CoordinateReferenceSystem crs3 = CRS.parseWKT(crs2.toWKT());
>
> assertTrue(crs1.equals(crs2)); OK
>
> assertTrue(crs2.equals(crs3)); FAILS
>
>
>  The reason I came to this was because I was trying to make sure that
> when I am reading data, it either
>
> has projection information, or the user has to prompted for it.
>
>
>
> If it doesn’t, there is no way for me to know unless I check that
>
>    1. the crs is either null when reading of shape files
>    2. the crd is set to the “default” when ASCII grid files or
>    georeferenced images
>
>  What I found is that even if the .prj file is present in the latter case,
> the statement
>
>    assertTrue(gc.getCoordinateReferenceSystem().equals(crs1)); (where gc
> is the GridCoverage2D)
>
> always returns false, even if the .prj file is that for EPSG:27200
>
>
>  So I suppose I have to look at the code to make sure I am indeed looking
> at the same coordinate system?
>
> Thanx
>
> Gaby
>
>
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to