Martin Desruisseaux-2 wrote:
> 
> pilloff a écrit :
>> Can the shapefile reader look in the .prj file
>> and the GeoTools supplied CRS database and determine the best match
>> automatically?
> 
> You may read the content of .prj file as WKT and gives it to
> 
>     CRS.parseWKT(String)
> 
> If you really need an EPSG code, it may be worth to try
> CRS.lookupIdentifier.
> 
>       Martin
> 
> 

Thanks for the reply.  I had tried using
dataStore.getSchema().getPrimaryGeometry().getCoordinateSystem() which
returned a CRS object.  However the .prj has no Bursa Wolf parameters so
CRS.findMathTransform failed with an operationNotFoundException.

Following your advice, I tried CRS.lookupIdentifier now but I get:

org.opengis.referencing.FactoryException: Geotools extension required for
"getIdentifiedObjectFinder" operation.

For reference, this is what I see when a print the CRS object returned by
getCoordinateSystem().

PROJCS["NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001",
  GEOGCS["GCS_North_American_1983",
    DATUM["D_North_American_1983",
      SPHEROID["GRS_1980", 6378137.0, 298.257222101]],
    PRIMEM["Greenwich", 0.0],
    UNIT["degree", 0.017453292519943295],
    AXIS["Longitude", EAST],
    AXIS["Latitude", NORTH]],
  PROJECTION["Lambert_Conformal_Conic"],
  PARAMETER["central_meridian", -71.5],
  PARAMETER["latitude_of_origin", 41.0],
  PARAMETER["standard_parallel_1", 41.71666666666667],
  PARAMETER["scale_factor", 1.0],
  PARAMETER["false_easting", 200000.0],
  PARAMETER["false_northing", 750000.0],
  PARAMETER["standard_parallel_2", 42.68333333333334],
  UNIT["m", 1.0],
  AXIS["x", EAST],
  AXIS["y", NORTH]]

It seems I need something reasonably clever to take just these raw names and
extract a CRS usable for transformations.  Any suggestions?

Thanks,
Mark

-- 
View this message in context: 
http://www.nabble.com/Automatically-parsing-.prj-files--tp15026215p15028239.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to