[gdal-dev] Error when trying to create layer in FileGDB
Casper Børgesen
caboe at sdfe.dk
Wed Jul 17 00:04:08 PDT 2019
Hi all,
I am trying to create a layer in an existing feature dataset in an existing File Geodatabase (FileGDB, not Open) using python and GDAL/OGR from OSGeo.
The layout of the FileGDB is:
MyData.gdb
Data
Polygon
The following is my code attempt:
>>> from osgeo import ogr
>>> ds = ogr.Open('MyData.gdb', 1)
>>> l = ds.CreateLayer('Line', None, ogr.wkbLineString, options=['FEATURE_DATASET=Data'])
ERROR 1: Failed at creating table for \Data\Line (Invalid spatial reference.)
Yes I didn't provide a spatial reference, but if None is invalid I might as well pick one used by an existing layer inside the feature dataset:
>>> l2 = ds.GetLayerByIndex(0)
>>> p2 = l2.GetSpatialRef()
>>> l2.GetName()
'Polygon'
>>> l = ds.CreateLayer('Line', p2, ogr.wkbLineString, options=['FEATURE_DATASET=Data'])
ERROR 1: Failed at creating table for \Data\Line (Invalid spatial reference.)
In both cases I get the same error, is this to be expected?
Regards, Casper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190717/6c559aab/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyData.gdb.zip
Type: application/x-zip-compressed
Size: 24526 bytes
Desc: MyData.gdb.zip
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190717/6c559aab/attachment-0001.bin>
More information about the gdal-dev
mailing list