Martin Desruisseaux ha scritto:
> Le jeudi 18 janvier 2007 à 17:13 +0100, Andrea Aime a écrit :
>> Now, there are a couple of issues here. The first one
>> is that CRS.parseWkt has create a lat/lon CRS, whilst
>> the EPSG one one has swapped axis.
> We may try to first add the special check for "Lon" and "Lat" axis names
> since they come from legacy OGC 01-009 specification and see if it
> resolve a majority of cases. If it doesn't work well enough, then we
> could consider the more complex AbstractIdentifiedObject.equals(...,
> SomeEnum) approach. What do you think?
In fact, adding the following code to DefaultCoordinateSystemAxis
fixes the issue (I basically overridden nameMatches to add special
treatment logic to lat/lon axis):
private static List latitudeAliases = Arrays.asList(new String[]
{"Lat", "Geodetic latitude", "Latitude"});
private static List longitudeAliases = Arrays.asList(new String[]
{"Lon", "Geodetic longitude", "Longitude"});
public boolean nameMatches(String name) {
String code = getName().getCode();
if(latitudeAliases.contains(name) &&
latitudeAliases.contains(code))
return true;
if(longitudeAliases.contains(name) &&
longitudeAliases.contains(code))
return true;
return super.nameMatches(name);
}
CRS.equalsIgnoreMetadata now gives me a positive match.
I just don't know if the above is the best way to tackle the problem.
I see there is explicit alias support, but international strings
as coded now pretend to be of the same class to match for equality,
so after a few tests I gave up and went for the easier route.
Cheers
Andrea
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel