Tom, The -skipfailures flag skips only failures to create new features. Null geometries in non-null shapetype shapefile are not handled. The only way I can think of to clean such a file is by checking the geometry in each feature.
On Thu, Aug 5, 2010 at 1:01 AM, Tom Jeffery <[email protected]> wrote: > > Chaitanya, > > I've found the issue with the particular shapefile I'm using. It actually > has some null geometries in it, which are fixable using ESRI's "Repair > Geometry" tool. I read that ogr2ogr is also suppose to remove records with > empty geometries, but it doesn't seem to be working on my file, even with > the -skipfailures flag set. > > Any thoughts? Or is there another good way to clean a shapefile that might > have null geometries? > > Thanks so much for your help so far! > > -Tom > > > Chaitanya kumar CH wrote: > > > > Tom, > > > > GDAL/OGR updates the shapefile along with the dbf file when a feature is > > changed. That means updating the extents according to the geometries in > > the > > changed features. My guess is that there is a problem reading a feature's > > geometry extents. > > > > Call the OGRGeometry::getEnvelope method on each geometry and check if > the > > OGREnvelope::MinX and OGREnvelope::MinY values are within the expected > > extents. You can isolate the problem this way. > > > > Otherwise, put together a sample dataset and create a new ticket at > > http://trac.osgeo.org/gdal/newticket > > > > On Wed, Aug 4, 2010 at 10:00 PM, Tom Jeffery <[email protected]> wrote: > > > >> > >> Chaitanya, > >> > >> The updated file is read properly with ogrinfo. The only difference > >> between > >> ogrinfo -al between the two, besides the new field that was created, is > >> the > >> extent, which looks like this: > >> > >> Original file: > >> Extent: (1528126.013001, 45899.818172) - (1542444.478012, 61468.662925) > >> > >> Updated file: > >> > >> > (-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000, > >> > >> > -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000) > >> - (1542444.478012, 61468.662925) > >> > >> That...is a really large negative number! Any idea why it might be > >> getting > >> blown up? > >> -Tom > >> > >> > >> Chaitanya kumar CH wrote: > >> > > >> > Tom, > >> > > >> > Can you check the destination shapefile with 'ogrinfo' and see if it > >> > works? > >> > If ogrinfo gives a valid output of the new file, check with 'ogrinfo > >> -al' > >> > and compare it with the old file's output. > >> > ( http://www.gdal.org/ogrinfo.html ) > >> > > >> > -- > >> > Best regards, > >> > Chaitanya kumar CH. > >> > /tʃaɪθənjə/ /kʊmɑr/ > >> > +91-9494447584 > >> > 17.2416N 80.1426E > >> > > >> > _______________________________________________ > >> > gdal-dev mailing list > >> > [email protected] > >> > http://lists.osgeo.org/mailman/listinfo/gdal-dev > >> > > >> > >> -- > >> View this message in context: > >> > http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Editing-attributes-with-ogr-causing-corrupt-shapefile-tp5372483p5373236.html > >> Sent from the GDAL - Dev mailing list archive at Nabble.com. > >> _______________________________________________ > >> gdal-dev mailing list > >> [email protected] > >> http://lists.osgeo.org/mailman/listinfo/gdal-dev > >> > > > > > > > > -- > > Best regards, > > Chaitanya kumar CH. > > /tʃaɪθənjə/ /kʊmɑr/ > > +91-9494447584 > > 17.2416N 80.1426E > > > > _______________________________________________ > > gdal-dev mailing list > > [email protected] > > http://lists.osgeo.org/mailman/listinfo/gdal-dev > > > > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Editing-attributes-with-ogr-causing-corrupt-shapefile-tp5372483p5373963.html > Sent from the GDAL - Dev mailing list archive at Nabble.com. > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev > -- Best regards, Chaitanya kumar CH. /tʃaɪθənjə/ /kʊmɑr/ +91-9494447584 17.2416N 80.1426E
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
