The datastore class gives you the list of type names:
String[] getTypeNames()
For a shapefile they only hold one kind of content - so it is a very short list
of one.
Jody
On 12/01/2011, at 6:14 AM, mounir younes wrote:
> I was trying to read a shapefile and print all it's features on screen
> but i couldn't find what the type name was so i am having problems and
> this is the code
>
> File file = new File("ex/example.shp");
> Map map = new HashMap();
> map.put( "url", file.toURL() );
> DataStore dataStore = DataStoreFinder.getDataStore(map );
>
> SimpleFeatureSource featureSource =
> dataStore.getFeatureSource("typename"); ====>what should i put instead
> of typename? and how would i know it?
> SimpleFeatureCollection collection = featureSource.getFeatures();
>
> SimpleFeatureIterator iter =collection.features();
> while(iter.hasNext())
> {
> SimpleFeature feature = iter.next();
> System.out.println(feature);
> }
> iter.close();
>
> thank you :D
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users