[gdal-dev] Re: Editing attributes with ogr causing corrupt shapefile

Chaitanya kumar CH chaitanya.ch at gmail.com
Wed Aug 4 14:07:56 EDT 2010


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 <tjeffery at gmail.com> 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
> > gdal-dev at lists.osgeo.org
> > 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
> gdal-dev at lists.osgeo.org
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100804/7642b41f/attachment.html


More information about the gdal-dev mailing list