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

<<attachment: MyData.gdb.zip>>

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to