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

Reply via email to