Thanks for the feedback, I think we should be able to use the
try-with-resources to take care of your iterator.
--
Jody Garnett
On 21 April 2015 at 12:27, Stefan Krausler <[email protected]>
wrote:
> Maven artifactId should be update from gt-shape to gt-shapefile.
>
> The code sample for accessing is not working.
>
> Updated working Version without any filter:
>
> File file = new File("example.shp");
> Map map = new HashMap();
> map.put("url", file.toURL());
> DataStore dataStore = DataStoreFinder.getDataStore(map);
> String typeName = dataStore.getTypeNames()[0];
>
> FeatureSource<SimpleFeatureType, SimpleFeature> source =
> dataStore.getFeatureSource(typeName);
> FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
> source.getFeatures();
> FeatureIterator<SimpleFeature> iterator = collection.features();
> try {
> while (iterator.hasNext()) {
> Feature feature = iterator.next();
> System.out.print(feature.getIdentifier().getID());
> System.out.print(" ");
>
> System.out.println(feature.getDefaultGeometryProperty().getValue());
> }
> } finally {
> iterator.close();
> }
>
> Thanks for the awesome project!
>
> Cheers
> Stefan
>
>
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel