Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve feature dataset name while open filegdb. #9781

Open
sendreams opened this issue Apr 26, 2024 · 3 comments
Open

resolve feature dataset name while open filegdb. #9781

sendreams opened this issue Apr 26, 2024 · 3 comments

Comments

@sendreams
Copy link

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

@rouault
Copy link
Member

rouault commented Apr 26, 2024

@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

@sendreams
Copy link
Author

@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.

@rouault
Copy link
Member

rouault commented Apr 30, 2024

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

auto poRootGroup = poDS->GetRootGroup();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants