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