From: Jody G. <jga...@re...> - 2008-05-21 17:42:41
|
There are a couple ways of talking about the same thing - use the CRS utility class to figure it out. SRID is kind of meaningless; or at least the meaning is defined by you for your application; I personally use SRID to mean "EPSG:<code>" and use the SRID number as my <code>. You will find that often the PostGIS spatial_ref_sys table is set up in this manner as well. srsName is used when communicating with WFS and WMS; it is often a string for the form: "EPSG:4326", or it could be more complicated, the GeoTools library does a pretty good job of handling this for you using CRS.decode( ... ) method. Farrukh Najmi wrote: > Current code base allows lookup of a JTS GeometryFactory using an SRID using the following: > > http://javadoc.geotools.fr/2.5/org/geotools/factory/Hints.html#JTS_SRID > > Problem is I only have an srsName to start with. > Don't worry about it too much; JTS does not care (or use) the SRID value; try and keep track of a CoordinateReferenceSystem object instead. > Thus, I am looking for a way to get an SRID from a srsName. > > How can I do this using geotools? If geotools does not support this, how can I use the spatial_ref_sys in postgis to do the lookup. Thanks for any advice. > You can query the table yourself and use CRS.fromWKT( ... ) - this is how the the PostGISDataStore returns your features with the correct CoordinateReferneceSystem. Here are the docs for CRS: - http://docs.codehaus.org/display/GEOTDOC/01+CRS+Helper+Class Cheers, Jody |