[gdal-dev] ogr python: copying features from postgis to postgis

Even Rouault even.rouault at spatialys.com
Mon Nov 28 14:21:46 PST 2016


On lundi 28 novembre 2016 18:19:40 CET Stefan Ziegler wrote:
> Hi Even
> 
> thanks for the hint:
> 
> ERROR 6: CreateFeature : unsupported operation on a read-only datasource.
> ERROR 6: CreateFeature : unsupported operation on a read-only datasource.
> ERROR 6: CreateFeature : unsupported operation on a read-only datasource.
> ERROR 6: CreateFeature : unsupported operation on a read-only datasource.
> ERROR 6: CreateFeature : unsupported operation on a read-only datasource.
> ERROR 6: CreateFeature : unsupported operation on a read-only datasource.
> 
> I didn't know that default setting is read-only mode. Changing to
> "ogr.Open(dstConnString, 1)" works like a charm.

OK, I've reproduced a similar issue. The error/exception handling in that case was suboptimal 
and should have reported the original error message in the exception text. I've now fixed 
that in GDAL trunk and you'll get :

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    lyr.CreateFeature(f)
  File "/home/even/gdal/trunk/gdal/swig/python/build/lib.linux-x86_64-2.7/osgeo/ogr.py", 
line 1479, in CreateFeature
    return _ogr.Layer_CreateFeature(self, *args)
RuntimeError: CreateFeature : unsupported operation on a read-only datasource.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161128/352d91e3/attachment.html>


More information about the gdal-dev mailing list