error when counting geometries in shapefile
-------------------------------------------
Key: GEOT-1250
URL: http://jira.codehaus.org/browse/GEOT-1250
Project: GeoTools
Issue Type: Bug
Components: data shapefile
Affects Versions: 2.2.0
Environment: java 1.4.12
Reporter: Jan Gregor
Assignee: Ian Wolfe Schneider
Attachments: 3.dbf, 3.shp
i've got problem with reading attached shapefile. tested in geotools 2.2.0,
2.2.2 and 2.3.1. problem is in getCount method, size method gives same result.
this is stacktrace:
java.lang.IllegalArgumentException: Read-only buffer
at sun.nio.ch.IOUtil.read(IOUtil.java:198)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:145)
at
org.geotools.data.shapefile.shp.ShapefileReader.readRecord(ShapefileReader.java:643)
at
org.geotools.data.shapefile.shp.ShapefileReader.getCount(ShapefileReader.java:602)
at
org.geotools.data.shapefile.ShapefileDataStore.getCount(ShapefileDataStore.java:1024)
at
org.geotools.data.AbstractFeatureSource.getCount(AbstractFeatureSource.java:250)
at
org.geotools.data.DefaultFeatureResults.getCount(DefaultFeatureResults.java:226)
and this is my java code ...
FeatureCollection fsShape = null;
try {
URL shapeURL = new java.io.File(shpFile).toURL();
ShapefileDataStore store = new ShapefileDataStore(shapeURL);
String name = store.getTypeNames()[0];
FeatureSource source = store.getFeatureSource(name);
fsShape = source.getFeatures();
// System.out.println("count:" + source.getCount(Query.ALL));
System.out.println("count2:" + fsShape.getCount());
} catch (Exception e2) {
e2.printStackTrace();
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel