From: <nic...@je...> - 2004-11-30 08:47:17
|
Hi! Is there anybody, who can give me a comment about my problem? I can= 't find out any solution for this! Thanks, a lot! Nico Zimmer From: Nico Zimmer on 25.11.2004 14:05 To: geo...@li... cc: Subject: java.io.IOException: Dbf has extra record" when opening Shapefile When opening ESRI shapefiles with the ShapefileDataStore (see code belo= w), some shapefiles produce an java.io.IOException ("Dbf has extra record")= . The affected shapefiles itself are ok. They can be opened by ArcInfo, ArcExplorer or e.g. shapelib without problems. Sample shapefile: (See attached file: testShapefile.zip) The stacktrace is: java.io.IOException: Dbf has extra record at org.geotools.data.shapefile.ShapefileDataStore$Reader.hasNext(Shapefile= DataStore.java:417) at org.geotools.data.FIDFeatureReader.hasNext(FIDFeatureReader.java:133= ) at org.geotools.data.DefaultFeatureResults.collection(DefaultFeatureResult= s.java:227) Testcase to reproduce the error: =00=A0=A0=A0=A0=A0=A0=A0=A0=A0URL url = =3D new URL( " file:///apron.shp" ); =00=00=A0=A0=A0=A0=A0=A0=A0=A0=A0// Create new da= tastore of the provided shapefile =00=A0=A0=A0=A0=A0=A0=A0=A0=A0ShapefileDataStore store =3D ne= w ShapefileDataStore( url ); =00=00=A0=A0=A0=A0=A0=A0=A0=A0=A0// Get filename, e.g. "runway" =00=A0= =A0=A0=A0=A0=A0=A0=A0=A0String storename =3D store.getTypeNames()[ 0 ]; =00=A0=A0=A0=A0=A0=A0=A0=A0=A0// Create feat= ure source =00=A0=A0=A0=A0=A0=A0=A0=A0=A0FeatureSource source =3D store.get= FeatureSource( storename ); =00=00=A0=A0=A0=A0=A0=A0=A0=A0=A0// Read attribute data from the fea= ture source. =00=A0=A0=A0=A0=A0=A0=A0=A0=A0FeatureResults fResults =3D source.getFeatures(); =00=00=A0=A0=A0=A0=A0=A0=A0=A0=A0// Get the Featu= reType. The FeatureType contains the attribute =00=A0=A0=A0=A0=A0=A0=A0=A0=A0// definitions of = the shapefile. =00=A0=A0=A0=A0=A0=A0=A0=A0=A0featureType =3D source.getSche= ma(); =00=00=A0=A0=A0=A0=A0=A0=A0=A0=A0// Create the FeatureCollection with all data from the FeatureResults. =00=A0=A0=A0=A0=A0=A0=A0=A0=A0featureCollection =3D fResults.collection(); =00=A0=A0=A0=A0=A0=A0=A0=A0=A0 =00=A0=A0=A0=A0=A0= =A0=A0=A0=A0System.out.println( "Completed successfully"); Nico Zimmer Advanced Business Development Jeppesen GmbH ----------------------------------------------------------------- Frankfurter Strasse 233 63263 Neu-Isenburg Telefon: (06102) 50 8490 Telefax: (06102) 50 8463 Email: Nic...@je... = |