I need to obtain the shp fields names, but I don't know how...
I'm a neewie using geotools and  I'm using this code to iterate over the
collection of features from the shapefile. (geotools 2.7M0)
Anybody know how to solve this...

Help is apreciated!



                        
File file = new File(myfile + ".shp");
                        Map connect = new HashMap();
                        connect.put("url", file.toURI().toURL());

                        DataStore dataStore = 
DataStoreFinder.getDataStore(connect);
                        String[] typeNames = dataStore.getTypeNames();
                        String typeName = typeNames[0];

                        SimpleFeatureSource featureSource = 
dataStore.getFeatureSource(typeName);
                        SimpleFeatureCollection collection = 
featureSource.getFeatures();
                        
                       // get the shape fields names and types... ¿?
 
                        Iterator iterator = collection.iterator();
                        //iterate over the collection...to obtenin features
values
                    
Many thanks!
Joseph
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/How-to-get-fields-name-from-a-shp-file-tp5157802p5157802.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to