Hi Even, Thanks for checking it out. I have a hard time seeing the joys of closed source software, but I continue to be tied to it and all its frustrations.
There definitely is something going on with the SRS even though OGR reports it as being the same: >>> l2 = ds.GetLayerByIndex(0) >>> p2 = l2.GetSpatialRef() >>> p = srs.SpatialReference() >>> p.ImportFromEPSG(25832) >>> p.IsSame(p2) 1 If have done a little digging in ArcCatalog and it also complains about invalid spatial reference when I try to move the "Polygon" feature class to a feature dataset created by OGR with the above "p" SRS. I can't see the differences in ArcCatalog regarding the SRS but the domains are different. But again it is closed source so precisely where the difference is between the two, it won't tell me. Thanks again! Regards, Casper -----Original Message----- From: Even Rouault <[email protected]> Sent: 17. juli 2019 10:51 To: [email protected] Cc: Casper Børgesen <[email protected]> Subject: Re: [gdal-dev] Error when trying to create layer in FileGDB Casper, I can reproduce. I tried a few things (including adding at hand definitions for MOrigin, MScale, MPrecision and LatestWKID that appear in the XML definition of the existing layer & feature dataset), but without success. It appears this is specific to creating the layer with FEATURE_DATASET=Data. Without that, it works. And there must be something specific to the SRS of the Data FeatureDataset too, because we have a test in the autotest suite that works: srs = osr.SpatialReference() srs.SetFromUserInput("WGS84") ds = ogrtest.fgdb_drv.CreateDataSource('tmp/test.gdb') ds.CreateLayer('layer1', srs=srs, geom_type=ogr.wkbPoint, options=['FEATURE_DATASET=featuredataset']) ds.CreateLayer('layer2', srs=srs, geom_type=ogr.wkbPoint, options=['FEATURE_DATASET=featuredataset']) ds = None The joys of working with closed source software... Even > 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 -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
