[gdal-dev] overwrite shapefile

Chaitanya kumar CH chaitanya.ch at gmail.com
Tue May 24 21:29:29 EDT 2011


You can use the OGRLayer::TestCapability() method to check write capability
of a layer. However, there are going to be errors if another process
accesses the files in the mean while.

When ogr2ogr is executed with -append, -overwrite or --update options, it
should error out with the message "Unable to open existing output
datasource" if a file cannot be opened to write. Can you raise a new ticket
[1] describing this problem?

[1]: http://trac.osgeo.org/gdal/newticket

On Wed, May 25, 2011 at 12:20 AM, Ramiro Gonzalez <
ramirogonzalez at suremptec.com.ar> wrote:

> hello
> I want to overwrite a shapefile using ogr(c++). If the dbf file in the
> destination shapefile is already open by anather program(exel), the
> operation fails in the middle and only the shp and shx files are updated.
> How could I check, using OGR, if the dbf(or any other file in the
> shapefile) is blocked before I overwrite it?
> I tested this with "ogr2ogr -overwrite destination source.shp" and the same
> thing happens
> Thanks,
> Ramiro
> _______________________________________________
> 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/
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110525/1288924f/attachment.html

More information about the gdal-dev mailing list