Hi,
I was investigating the possibility of comparing a random
WKT file found along with a shapefile or grid coverage
against the EPSG database to find out the equivalent
EPSG code.

Consider the following random wkt file contents:

GEOGCS["GCS_North_American_1983",DATUM["North_American_Datum_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

which gets interpreted by parse and then toWkt into:

GEOGCS["GCS_North_American_1983",
   DATUM["North_American_Datum_1983",
     SPHEROID["GRS_1980", 6378137.0, 298.257222101]],
   PRIMEM["Greenwich", 0.0],
   UNIT["degree", 0.017453292519943295],
   AXIS["Lon", EAST],
   AXIS["Lat", NORTH]]

and the equivalent EPSG definition, EPSG:4296:

GEOGCS["NAD83",
   DATUM["North American Datum 1983",
     SPHEROID["GRS 1980", 6378137.0, 298.257222101, 
AUTHORITY["EPSG","7019"]],
     TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0],
     AUTHORITY["EPSG","6269"]],
   PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
   UNIT["degree", 0.017453292519943295],
   AXIS["Geodetic latitude", NORTH],
   AXIS["Geodetic longitude", EAST],
   AUTHORITY["EPSG","4269"]]

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.

I hope that forcing lon/lat axis would get me a lon/lat
one out of the epsg database, but a modified original wkt that forces 
the same axis order as wkt won't match anyways:

GEOGCS["GCS_North_American_1983",DATUM["North_American_Datum_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295],AXIS["Lat",NORTH],AXIS["Lon",EAST]]

because even using AbstractIdentifiableObject.equals(xxx, false) to 
avoid metadata comparison, axis names and such are considered to be
relevant, and this makes it impossible to compare them.

I would like a more lenient way to do the comparison, that uses
only the spheroid parameters, the projection parameters, primem, and 
unit. Is there any way to get it?

I could code a special comparator for each kind of CRS (projected, 
geographic and the like) but was wondering if there is a better way,
and if I'm making some mistake in assuming the more lenient method
is a good one.

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

Reply via email to