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