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