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

Reply via email to