Diego Guidi ha scritto:
> How it's possible to know the reference system informations of a
> datastore (i.e: a shapefile analyzed via ShapefileDataStore)? We have
> some documentations about tha, and possibly about coordinate
> conversions in geotools?

The CRS is not associated to the datastore, but to the single geometric
column, since database backed stores may have multiple geometry columns 
and different CRS in each.
The current way is to do it with a shapefile (which has just one 
geometry) is:

myFeatureType.getDefaultGeometry().getCoordinateSystem()

You can build a transform using the following:

Transform t = CRS.transform(fromCrs, toCrs)

To apply the transform, you either get a reader from your datastore
and wrap it into a ReprojectFeatureReader, or you can call getView()
from the datastore, and then query the view with a query where
the coordinateSystemReproject property has been set (which will
build a ReprojecFeatureReader under cover, wrap it in a feature 
collection, and return that feature collection).

Oh, of course all the above holds only if you have a .prj along
with your shapefile, otherwise no CRS information will be available.
If you have other sources of information about what the CRS is,
you'll have to build the source CRS as well (using CRS.decode
or other methods) in the reader case, or state the forced crs
in the view + query case (there's a coordinateSystem property
in query that can be used for force the CRS).

Hope this helps
Cheers
Andrea Aime

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to