Hi Jody, thanks for the answer. Sorry for my ignorance, but I'm using udig 1.3.1 and there is no method crs1.equals( crs2, false ). Then I used the static method CRS.equalsIgnoreMetadata(crs1, crs2) and it looks like it worked. There is some caution when using this method?
Marcelo Pacheco >Ca you try equals ignore metadata? > >crs1.equals( crs2, false ) > >And do step into the equals name / check - there must be a reason for it to return false. >-- >Jody Garnett On Thursday, 22 November 2012 at 4:57 AM, Marcelo Pacheco wrote: > Dear all, > > I'm trying to compare two CoordinateReferenceSystem. I use reference http://docs.geotools.org/latest/userguide/library/referencing/compare.html. > This is the code: > > CoordinateReferenceSystem featureCRS = feature.getFeatureType(). > getCoordinateReferenceSystem() ; > CoordinateReferenceSystem wgs84CRS = CRS.decode("EPSG:4326"); > System.out.println("featureCRS = " + featureCRS.toString()); > System.out.println(); > System.out.println("wgs84CRS = " + wgs84CRS.toString()); > System.out.println(); > System.out.println("equals = " + featureCRS.equals(wgs84CRS)); > > System.out.println(); > System.out.println(); > > System.out.println("featureCRS name = " + featureCRS.getName().toString()); > System.out.println("wgs84CRS name = " + wgs84CRS.getName().toString()); > System.out.println(); > System.out.println("equals name = " + featureCRS.getName().equals(wgs84CRS.getName())); > > > produces the following: > > featureCRS = GEOGCS["WGS 84", > DATUM["World Geodetic System 1984", > SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], > AUTHORITY["EPSG","6326"]], > PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], > UNIT["degree", 0.017453292519943295], > AXIS["Geodetic longitude", EAST], > AXIS["Geodetic latitude", NORTH], > AUTHORITY["EPSG","4326"]] > > wgs84CRS = GEOGCS["WGS 84", > DATUM["World Geodetic System 1984", > SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], > AUTHORITY["EPSG","6326"]], > PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], > UNIT["degree", 0.017453292519943295], > AXIS["Geodetic longitude", EAST], > AXIS["Geodetic latitude", NORTH], > AUTHORITY["EPSG","4326"]] > > equals = false > > > featureCRS name = EPSG:WGS 84 > wgs84CRS name = EPSG:WGS 84 > > equals name = false > > > Why the return of the "equal()" is false? > What am I do wrong? > > Thanks!!
_______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel
