hello group,

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. does have
somebody idea what's going on ?  or exists for shapefiles some
validation software from ESRI ?

thanks,
Jan

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)


       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();
       }

Attachment: 3.dbf
Description: Binary data

Attachment: 3.shp
Description: Binary data

-------------------------------------------------------------------------
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-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to