Thanks Jody
But I noticed that the second implementation doesn't get the layer projection. Am I right? Thanks Feras From: Jody Garnett [mailto:[email protected]] Sent: Sunday, August 22, 2010 1:51 PM To: Feras Odeh Cc: [email protected] Subject: Re: [Geotools-gt2-users] Which class should I use To read ShapeFile?? They are the same class (ie an instance of ShapefileDataStore). There are actually two implementations (one uses an index and one does not ... by using the FileDataStoreFinder (with a file) or DataStoreFinder (with a map of connection parameters) GeoTools should use the correct one. Jody On 22/08/2010, at 8:18 PM, Feras Odeh wrote: Hello.. I'm trying to read shape file using geotools but the problem is that I see the quick start tutorial using this code to read shape file File file = JFileDataStoreChooser.showOpenFile("shp", null); if (file == null) { return; } FileDataStore store = FileDataStoreFinder.getDataStore(file); FeatureSource featureSource = store.getFeatureSource(); // Create a map context and add our shapefile to it MapContext map = new DefaultMapContext(); map.setTitle("Quickstart"); map.addLayer(featureSource, null); // Now display the map JMapFrame.showMap(map); And When I search the demo's within the project I got this code ShapefileDataStore dstore = null; DataStore found = repository.dataStore( shapefileURL.toString()); if( found != null && found instanceof ShapefileDataStore){ dstore = (ShapefileDataStore) found; } else { try { dstore = new ShapefileDataStore(shapefileURL); } catch (MalformedURLException urlEx) { throw new RuntimeException(urlEx); } repository.register( shapefileURL.toString(), dstore ); } SO which one should I use?? Thanks Feras ---------------------------------------------------------------------------- -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
