<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. &nbsp;If I try running without the backend
DB, and do:</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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">&nbsp;- 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">&nbsp; &nbsp; &nbsp; &nbsp; at
java.lang.Character.toLowerCase(Character.java:4175)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
java.lang.String.toLowerCase(String.java:2409)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
java.lang.String.toLowerCase(String.java:2497)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.toCaseless(DatumAliases.java:230)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.getAliases(DatumAliases.java:363)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.addAliases(DatumAliases.java:436)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotools.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:572)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; at
org.geotoolkit.referencing.factory.DatumAliases.createPrimeMeridian(DatumAliases.java:605)</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; 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">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; String name = &quot;ED50&quot;;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; String wkt =</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &quot;GEOGCS[\&quot;&quot; + name +
&quot;\&quot;,\n&quot; +</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &quot; &nbsp;DATUM[\&quot;European
Datum 1950\&quot;,\n&quot; +</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &quot; &nbsp;SPHEROID[\&quot;International
1924\&quot;, 6378388.0, 297.0]],\n&quot; +</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &quot;PRIMEM[\&quot;Greenwich\&quot;,
0.0],\n&quot; +</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &quot;UNIT[\&quot;degree\&quot;, 0.017453292519943295]]&quot;;</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">&nbsp; &nbsp; &nbsp; &nbsp; 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 &lt;j.d.blower@reading.ac.uk&gt;</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 &lt;martin.desruisseaux@geomatys.fr&gt;</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
&lt;Calum.Byrom@tessella.com&gt;</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 &nbsp; &nbsp; &nbsp; &nbsp; 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! &nbsp;Was that method present in GeoTools? &nbsp;If so I must
have<br>
missed it. &nbsp;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&lt;martin.desruisseaux@geomatys.fr&gt; wrote:<br>
&gt; Hello Jon<br>
&gt;<br>
&gt; Jon Blower a écrit :<br>
&gt;&gt;<br>
&gt;&gt; Is there any way in which I can find out the corresponding CRS
code<br>
&gt;&gt; (e.g. the EPSG code), or better still, an OGC URN, from a<br>
&gt;&gt; CoordinateReferenceSystem object? &nbsp;That is, I want to do
the reverse<br>
&gt;&gt; of CRS.decode(String crsCode).<br>
&gt;<br>
&gt; Yes, the following method is there exactly for that. You need an EPSG<br>
&gt; database however, either the embedded JavaDB or a database on PostgreSQL,
at<br>
&gt; your choice.<br>
&gt;<br>
&gt; http://www.geotoolkit.org/apidocs/org/geotoolkit/referencing/CRS.html#lookupIdentifier(org.opengis.referencing.IdentifiedObject,%20boolean)<br>
&gt;<br>
&gt; Please let me know if you have any issue.<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;Regards,<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Martin<br>
&gt;<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>