Martin Desruisseaux ha scritto:
> Le mercredi 07 février 2007 à 20:04 +0100, Andrea Aime a écrit :
>> do you have any idea why the following two CRS are
>> declared as non equal by CRS.equalsIgnoreMetadata?
>
> I don't see anything in the WKT that explain the difference. Would it be
> possible to test some pieces in order to try to catch more accuratly
> where the problem occurs?
The following main:
public static void main(String[] args) throws FactoryException {
String wkt1 =
"GEOGCS[\"GCS_WGS_1984\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\",
6378137.0, 298.257223563]],PRIMEM[\"Greenwich\", 0.0],UNIT[\"degree\",
0.017453292519943295],AXIS[\"Lon\", EAST],AXIS[\"Lat\", NORTH]]";
String wkt2 = "GEOGCS[\"WGS 1984\",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\"]]";
GeographicCRS crs1 = (GeographicCRS) CRS.parseWKT(wkt1);
GeographicCRS crs2 = (GeographicCRS) CRS.parseWKT(wkt2);
System.out.println("CRS: " + CRS.equalsIgnoreMetadata(crs1, crs2));
System.out.println("Datum: " +
CRS.equalsIgnoreMetadata(crs1.getDatum(), crs2.getDatum()));
}
Shows that datum comparison returns false. Debugging shows this happens
because datums with different names are considered to be different when
we don't compare metadata... hum, this seems to be wrong to me?
The above logic is in AbstractDatum.java:
if (!compareMetadata) {
/*
* Tests for name, since datum with different name have completly
* different meaning. We don't perform this comparaison if the user
* asked for metadata comparaison, because in such case the names
* have already been compared by the subclass.
*/
return nameMatches(object. getName().getCode()) ||
nameMatches(object, getName().getCode());
}
final AbstractDatum that = (AbstractDatum) object;
return this.realizationEpoch == that.realizationEpoch &&
Utilities.equals(this.validArea, that.validArea ) &&
Utilities.equals(this.anchorPoint, that.anchorPoint) &&
Utilities.equals(this.scope, that.scope);
I'd say, if we don't want to compare metadata, not even names should be
considered, but only the ellipsoid parameters and the bursa-worlf
transform (provided the latter is available)?
Cheers
Andrea
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel