1

In the FileGDB vector driver documentation, it states that writing support has been added in GDAL 3.5 for field domains. However, it isn't documented how to do so.

For context, I am working on a .gdb file that has multiple fields, multiple layers, and no existing field domains. I want to be able to programmatically create domains, and attach them to specific fields in multiple layers using ogr2ogr (or some other gdal vector program). Unfortunately won't be able to use arcpy or arcgis desktop.

I have tried using sql and in different dialects, but have failed to even create a domain.

1 Answer 1

4

The field domain support was implemented by this Pull Request https://github.com/OSGeo/gdal/pull/3638

If I understand it right, ogr2ogr can read existing field domains and copy them into a new datastore. At the moment the datastore must be either FileGDB or GeoPackage. Ogr2ogr cannot create field domains so they must be created programmatically. A Python example can be found from the GDAL autotests https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_openfilegdb_write.py#L2490.

Tests for field domains in GeoPackage are here https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_gpkg.py#L5705, and there is also an own non-driver specific set of tests for field domains https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_fielddomain.py.

2
  • Thanks! I actually found the pull request for it, but not the tests. If I understood correctly, I shouldn't need the "FileGDB" driver for it, and the "OpenFileGDB" driver would be fine, right? Commented May 24, 2023 at 13:06
  • The first linked tests are for OpenFileGDB so it is supposed to work.
    – user30184
    Commented May 24, 2023 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.