Shapefile feature could not be read
-----------------------------------

                 Key: GEOT-2051
                 URL: http://jira.codehaus.org/browse/GEOT-2051
             Project: GeoTools
          Issue Type: Bug
          Components: data shapefile
    Affects Versions: 2.5-RC0
         Environment: Windows XP, jars downloaded from website, JDK 1.6_07, 
Eclipse 3.4
            Reporter: ian dees
            Assignee: Jesse Eichar
         Attachments: hydrography.zip

Reading in a Flowline shapefile exported from two or three National Hydrography 
Dataset hydrologic units and I get the following after reading in approximately 
50-70 MultiLineString:

{code:java}
Exception in thread "main" java.util.NoSuchElementException: Feature could not 
be read; a the index may be invalid
        at 
org.geotools.data.shapefile.indexed.IndexedFidReader.next(IndexedFidReader.java:296)
        at 
org.geotools.data.FIDFeatureReader.readFeature(FIDFeatureReader.java:124)
        at org.geotools.data.FIDFeatureReader.next(FIDFeatureReader.java:98)
        at org.geotools.data.FIDFeatureReader.next(FIDFeatureReader.java:55)
        at 
org.geotools.data.store.FeatureReaderIterator.next(FeatureReaderIterator.java:71)
        at 
org.geotools.data.store.FeatureReaderIterator.next(FeatureReaderIterator.java:41)
        at 
org.geotools.feature.collection.DelegateFeatureIterator.next(DelegateFeatureIterator.java:58)
        at Main.main(Main.java:72)
{code}

Code around Main.java:72:

{code:java}
File shapeFile = new File("NHDFlowline.shp");
Map<String, Serializable> connectParameters = new HashMap<String, 
Serializable>();
connectParameters.put("url", shapeFile.toURI().toURL());
DataStore dataStore = DataStoreFinder.getDataStore(connectParameters);
String[] typeNames = dataStore.getTypeNames();
for (String typeName : typeNames) {

                FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
                FeatureCollection<SimpleFeatureType, SimpleFeature> collection;
                FeatureIterator<SimpleFeature> iterator;
                
                featureSource = dataStore.getFeatureSource(typeName);
                collection = featureSource.getFeatures();
                iterator = collection.features();  // <---- Line 72 is here
}
{code}

Shapefile is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to