[gdal-dev] Re: Editing attributes with ogr causing corrupt shapefile
tjeffery at gmail.com
Wed Aug 4 16:43:18 EDT 2010
I wrote up a method to find and delete geometries that fall outside of the
reported Extent from the shapefile. It seems to be doing the trick, though
with some strange side effects.
It finds the bad features properly, and I remove them with
layer.DeleteFeature(feature.GetFID()), but the .shp part of the shapefile is
never updated. (The dbf is the only file to change.) Everything looks fine
in OGR and ArcGIS, but if I run repair geometry in ArcGIS on the same file,
it deletes the "same" records, causing the file to become completely
I seem to recall reading about this before, but haven't turned up anything
in google searches. Is there a method to properly delete a record so the
.shp is updated as well?
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 <tjeffery at gmail.com> wrote:
> 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
> 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
> have null geometries?
> Thanks so much for your help so far!
View this message in context: http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Editing-attributes-with-ogr-causing-corrupt-shapefile-tp5372483p5374225.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev