The thing is - we ran out of the "SRID" number being useful. I believe some of
the database drive datastores (that actually use SRID as an index to a spatial
ref systems table) make use of an actual number.
In general we have to use a real CoordianteReferenceSystem object; here are the
docs for that:
-
http://docs.geotools.org/latest/userguide/guide/library/opengis/feature.html#coordinate-reference-system
--
Jody Garnett
On Tuesday, 15 March 2011 at 2:44 PM, Alessandro Ferrucci wrote:
> Hello,
> I'm reading Geometries from features in a shapefile.
> Shapefile is defined as CRS NAD83 (4269), but when I extract a
> defaultGeometry from any of its features, and do
>
> geom.getSRID();
>
> it always returns 0.
>
> I would have thought that a default geometry extracted from a shapefile that
> has a defined SRID would have that same SRID set on the geometry ?
>
> code is pretty much straight from the docs.
>
> Map map = new HashMap();
> map.put("url", shpfilef.toURI().toURL());
> DataStore store = DataStoreFinder.getDataStore(map);
> String[] typeNames = store.getTypeNames();
> String typeName = typeNames[0];
> FeatureSource<SimpleFeatureType, SimpleFeature> featureSource =
> store.getFeatureSource(typeName);
> FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
> featureSource.getFeatures();
> FeatureIterator<SimpleFeature> iterator = collection.features();
>
> while (iterator.hasNext()) {
> SimpleFeature feature = iterator.next();
> Geometry geom = (Geometry) feature.getDefaultGeometry();
> logger.info("SRID: " + geom.getSRID());
> }
>
>
> Thank you very much
> --
> Signed,
> Alessandro Ferrucci
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users