Hello again, and thanks a lot for the fast feedback!

Well, in my really humble opinion, if the guy stated that the code is 
EPSG:6618, then that is what he wants, regardless of any imprecisions in 
the WKT. If he wanted something else, why put the code?

Looking at things from my perspective, I think it makes some (but 
little) sense to enforce Datum names, if that is a standard, but I agree 
that checking the parameters when the name differs makes a lot more sense.
But I really think that enforcing the numbers in a text file to have 
exactly the same precision as in the EPSG database is kinda out of 
control. In my particular case, the software that generates the WKT has 
the flattening and computes its inverse to output the WKT, meaning that 
all those numbers are floating points with a lot of digits after the 
point. Since different CRSs have different official precisions, I think 
there is no way one can guarantee that the WKT will work in GeoTools 
unless each number is printed with a different precision according to 
the official EPSG values. Kinda complicated, in my opinion..

> 
> Because we found out that only the system property works 100% of the 
> cases in GeoServer. See:
> http://jira.codehaus.org/browse/GEOT-1704

Hmm, actually it didn't work here. Don't know what's going on, but I can 
live with the idea that "x" and "y" are too generic and not really equal 
to "Easting" and "Northing". And it's not that relevant for my 
particular needs anymore since we were able to change how those names 
are generated.
In any case, the code I tried (and failed) is exactly the following:

---

System.setProperty("org.geotools.referencing.forceXY", "true");

String wkt = "PROJCS[\"SAD69 / UTM zone 23S\"," +
"GEOGCS[\"SAD69\"," +
"DATUM[\"South American Datum 1969\"," +
"SPHEROID[\"GRS 1967 (SAD69)\", 6378160.0, 298.25, 
AUTHORITY[\"EPSG\",\"7050\"]]," +
"TOWGS84[-66.87, 4.37, -38.52, 0.0, 0.0, 0.0, 0.0]," +
"AUTHORITY[\"EPSG\",\"6618\"]]," +
"PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]]," +
"UNIT[\"degree\", 0.017453292519943295]," +
"AXIS[\"Geodetic longitude\", EAST]," +
"AXIS[\"Geodetic latitude\", NORTH]," +
"AUTHORITY[\"EPSG\",\"4618\"]]," +
"PROJECTION[\"Transverse Mercator\", AUTHORITY[\"EPSG\",\"9807\"]]," +
"PARAMETER[\"central_meridian\", -45.0]," +
"PARAMETER[\"latitude_of_origin\", 0.0]," +
"PARAMETER[\"scale_factor\", 0.9996]," +
"PARAMETER[\"false_easting\", 500000.0]," +
"PARAMETER[\"false_northing\", 10000000.0]," +
"UNIT[\"m\", 1.0]," +
"AXIS[\"x\", EAST]," +
"AXIS[\"y\", NORTH]]";

CoordinateReferenceSystem crs = CRS.parseWKT(wkt);
Integer srid = CRS.lookupEpsgCode(crs, true);

---

Anyway, I guess I'm more concerned about the first issue :)

Cheers
Milton

> 
> Cheers
> Andrea
> 

-- 

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to