<br><font size=2 face="sans-serif">Tessella Ref: NPD/6091/PR/TN/2009JUN18/18:07:40<br>
<br>
Thanks for looking into this, Jon - and thanks for the info Martin.</font>
<br>
<br><font size=2 face="sans-serif">I've been trying to get this to work
but have hit some problems. If I try running without the backend
DB, and do:</font>
<br>
<br><font size=2 face="sans-serif">
crsCode
= CRS.lookupIdentifier(null, crs, true);</font>
<br>
<br><font size=2 face="sans-serif">(i.e. with a null Citation - since I'm
not sure what this needs to be set to) then I get back a code - although
this is the same code that can be found via </font>
<br>
<br><font size=2 face="sans-serif">crs</font><font size=2 face="Courier New">.getName()</font><font size=2 face="sans-serif">.getCode()<br>
</font>
<br><font size=2 face="sans-serif">- so I guess it's just doing a default
fall back on this?</font>
<br>
<br><font size=2 face="sans-serif">If I use the simpler interface, i.e.:</font>
<br>
<br><font size=2 face="sans-serif">
crsCode
= CRS.lookupIdentifier(crs, true);</font>
<br>
<br><font size=2 face="sans-serif">then this returns only nulls.</font>
<br>
<br><font size=2 face="sans-serif">I then tried adding the supporting DBs
by including the jar files on the classpath - I tried the following two:</font>
<br>
<br><font size=2 face="sans-serif"><b>epsg-wkt-2.5-SNAPSHOT.jar</b></font>
<br><font size=2 face="sans-serif"> - produces identical results to
before</font>
<br>
<br><font size=2 face="sans-serif"><b>epsg-hsql-2.5-SNAPSHOT.jar </b>-
which requires the hsql.jar too (although this isn't actually specified
anywhere).</font>
<br><font size=2 face="sans-serif">- this only runs occasionally - usually
falling over with a StackOverflow:</font>
<br>
<br><font size=2 face="sans-serif">java.lang.StackOverflowError</font>
<br><font size=2 face="sans-serif"> at
java.lang.Character.toLowerCase(Character.java:4175)</font>
<br><font size=2 face="sans-serif"> at
java.lang.String.toLowerCase(String.java:2409)</font>
<br><font size=2 face="sans-serif"> at
java.lang.String.toLowerCase(String.java:2497)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.toCaseless(DatumAliases.java:230)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.getAliases(DatumAliases.java:363)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.addAliases(DatumAliases.java:436)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif"> at
org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif"> at
org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif"> at
org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif"> at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif"> at
org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)</font>
<br><font size=2 face="sans-serif">.....</font>
<br>
<br>
<br><font size=2 face="sans-serif">NB, I tried using the example code,
</font>
<br>
<br><font size=2 face="sans-serif">
String name = "ED50";</font>
<br><font size=2 face="sans-serif">
String wkt =</font>
<br><font size=2 face="sans-serif">
"GEOGCS[\"" + name +
"\",\n" +</font>
<br><font size=2 face="sans-serif">
" DATUM[\"European
Datum 1950\",\n" +</font>
<br><font size=2 face="sans-serif">
" SPHEROID[\"International
1924\", 6378388.0, 297.0]],\n" +</font>
<br><font size=2 face="sans-serif">
"PRIMEM[\"Greenwich\",
0.0],\n" +</font>
<br><font size=2 face="sans-serif">
"UNIT[\"degree\", 0.017453292519943295]]";</font>
<br>
<br><font size=2 face="sans-serif">- when this resolves, it only resolves
to 'ED50'.</font>
<br>
<br><font size=2 face="sans-serif">Additionally, I tried using </font>
<br>
<br><font size=2 face="sans-serif"> DefaultVerticalCRS.GEOIDAL_HEIGHT</font>
<br>
<br><font size=2 face="sans-serif">- this resolves to, '</font><font size=2 face="Courier New">WGS84(DD)</font><font size=2 face="sans-serif">'.</font>
<br>
<br><font size=2 face="sans-serif">Is there anything obvious I'm doing
wrong here?</font>
<br>
<br><font size=2 face="sans-serif">Thanks, in advance, for your help,</font>
<br>
<br><font size=2 face="sans-serif">Calum.</font>
<br>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Jon Blower <j.d.blower@reading.ac.uk></b>
</font>
<br><font size=1 face="sans-serif">Sent by:</font>
<br><font size=1 face="sans-serif">jon.blower@gmail.com</font>
<p><font size=1 face="sans-serif">17/06/2009 20:34</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">Martin Desruisseaux <martin.desruisseaux@geomatys.fr></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">Geotoolkit@lists.osgeo.org, Calum Byrom
<Calum.Byrom@tessella.com></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [geotk] Finding a CRS code/URN from
a CoordinateReferenceSystem object</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hi Martin,<br>
<br>
Excellent! Was that method present in GeoTools? If so I must
have<br>
missed it. We plan to migrate to Geotoolkit anyway when we have a<br>
chance.<br>
<br>
So I guess the WKT database doesn't support this?<br>
<br>
Cheers, Jon<br>
<br>
On Wed, Jun 17, 2009 at 8:25 PM, Martin<br>
Desruisseaux<martin.desruisseaux@geomatys.fr> wrote:<br>
> Hello Jon<br>
><br>
> Jon Blower a écrit :<br>
>><br>
>> Is there any way in which I can find out the corresponding CRS
code<br>
>> (e.g. the EPSG code), or better still, an OGC URN, from a<br>
>> CoordinateReferenceSystem object? That is, I want to do
the reverse<br>
>> of CRS.decode(String crsCode).<br>
><br>
> Yes, the following method is there exactly for that. You need an EPSG<br>
> database however, either the embedded JavaDB or a database on PostgreSQL,
at<br>
> your choice.<br>
><br>
> http://www.geotoolkit.org/apidocs/org/geotoolkit/referencing/CRS.html#lookupIdentifier(org.opengis.referencing.IdentifiedObject,%20boolean)<br>
><br>
> Please let me know if you have any issue.<br>
><br>
> Regards,<br>
><br>
> Martin<br>
><br>
<br>
<br>
<br>
-- <br>
Dr Jon Blower<br>
Technical Director, Reading e-Science Centre<br>
Environmental Systems Science Centre<br>
University of Reading<br>
Harry Pitt Building, 3 Earley Gate<br>
Reading RG6 6AL. UK<br>
Tel: +44 (0)118 378 5213<br>
Fax: +44 (0)118 378 6413<br>
j.d.blower@reading.ac.uk<br>
http://www.nerc-essc.ac.uk/People/Staff/Blower_J.htm<br>
</tt></font>
<br><font size=2 face="sans-serif"><br>
<br>
<br>
<br>
<br>
<br>
</font>