resolve feature dataset name while open filegdb.
Feature description
Currently, GDAL cannot retrieve the name of a feature dataset. If a geodatabase contains multiple datasets and there are feature classes with the same name, it can lead to issues.
Additional context
No response
@sendreams This might be a bit tricky to handle on OGR side. We'll probably have to prefix the layer name with the feature dataset name to build uniqueness. Anyway to do that, it would be great if you could attach such a geodatabase (zipped) to that ticket. If not possible, just pasting the output of ogrinfo the.gdb/a00000001.gdbtable -al -q and ogrinfo the.gdb/a00000004.gdbtable -sql "select Name, PhysicalName, Path from GDB_Items" -al -q (where you substitute the.gdb by the actual filename) would be a good start
@rouault thanks Sorry for the late reply. I've just found out that ArcGIS Pro doesn't allow creating two feature classes with the same name. The current issue is that GDAL can't retrieve the feature dataset name.
Actually, you can get it with ogrinfo. Feature datasets are modeled as groups:
$ ogrinfo autotest/ogr/data/filegdb/featuredataset.gdb
INFO: Open of `autotest/ogr/data/filegdb/featuredataset.gdb'
using driver `OpenFileGDB' successful.
Layer: standalone (Point)
Group fd1:
Layer: fd1_lyr1 (Point)
Layer: fd1_lyr2 (Point)
Group fd2:
Layer: fd2_lyr (Point)
$ ogrinfo autotest/ogr/data/filegdb/featuredataset.gdb -json
[...]
"rootGroup":{
"layerNames":[
"standalone"
],
"groups":[
{
"name":"fd1",
"layerNames":[
"fd1_lyr1",
"fd1_lyr2"
],
"groups":[]
},
{
"name":"fd2",
"layerNames":[
"fd2_lyr"
],
"groups":[]
}
]
},
"relationships":{}
}
API whise, this is with GDALDataset::GetRootGroup(), GDALGroup::GetGroupNames(), GDALGroup::OpenGroup(), GDALGroup::GetVectorLayerNames(). Cf https://github.com/OSGeo/gdal/blob/e99530dfb3672b664de293874477addc061745be/apps/ogrinfo_lib.cpp#L2075