I don't know but I got the following exception when clicking on a feature on
a map using the second implementation
org.geotools.map.DefaultMapContext getLayerBounds
SEVERE: It was not possible to get a projected bounds estimate
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException:
java.lang.IllegalArgumentException: Argument "sourceCRS" should not be null.
at
org.geotools.swing.tool.InfoTool.onMouseClicked(InfoTool.java:175)
at
org.geotools.swing.tool.MapToolManager.mouseClicked(MapToolManager.java:130)
Caused by: java.lang.IllegalArgumentException: Argument "sourceCRS" should
not be null.
at
org.geotools.referencing.operation.AbstractCoordinateOperationFactory.ensure
NonNull(AbstractCoordinateOperationFactory.java:732)
at
org.geotools.referencing.operation.BufferedCoordinateOperationFactory.create
Operation(BufferedCoordinateOperationFactory.java:247)
at org.geotools.referencing.CRS.findMathTransform(CRS.java:1046)
at
org.geotools.data.DefaultFeatureResults.<init>(DefaultFeatureResults.java:12
2)
at
org.geotools.data.AbstractFeatureSource.getFeatures(AbstractFeatureSource.ja
va:209)
at
org.geotools.swing.tool.VectorLayerHelper.getInfo(VectorLayerHelper.java:151
)
at
org.geotools.swing.tool.VectorLayerHelper.getInfo(VectorLayerHelper.java:58)
at
org.geotools.swing.tool.InfoTool.onMouseClicked(InfoTool.java:173)
... 23 more
Thanks
Feras
From: Jody Garnett [mailto:[email protected]]
Sent: Sunday, August 22, 2010 3:24 PM
To: Feras Odeh
Cc: [email protected]
Subject: Re: [Geotools-gt2-users] Which class should I use To read
ShapeFile??
The layer projection should be read from the shapefile prj file.
Jody
On 22/08/2010, at 9:16 PM, Feras Odeh wrote:
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