I'm trying to get an ESRI File Geodatabase domains by using the GDAL\OGR library. By doing so, I wish to edit this datasource using QGIS' Attributes Form with designated value map widgets that point to this domains.

I'm familiar with QGIS\OGR's capabilities of opening, viewing and even altering File Geodatabase (using FileGDB driver). What's missing is the ability to extract the properties of the FGDB itself - such as 'domains'.

Is there any way to extract FileGDB domains only using OSGeo programs without the help of ArcGIS software?


3 Answers 3


I found a perfect answer for my question in a post I found in Alex Tereshenkov's blog. The post contains a python script for printing the FGDB's domains in python interpreter:

from __future__ import print_function
import json
import xml.etree.ElementTree as ET
import ogr

gdb_path = r'C:\GIS\data\Adv.gdb'
ds = ogr.Open(gdb_path)
res = ds.ExecuteSQL('select * from GDB_Items')

for i in xrange(0, res.GetFeatureCount()):
    item = json.loads(
    if item:
        xml = ET.fromstring(item)
        if xml.tag == 'GPCodedValueDomain2':

            for table in xml.iter('CodedValues'):
                for child in table:
                    print(child.find('Code').text, child.find('Name').text)

        if xml.tag == 'GPRangeDomain2':

# Domain1
# Desc1
# esriFieldTypeString
# a aa
# b bb

# Domain2
# Desc2
# esriFieldTypeInteger
# 1 aa
# 2 bb
# 3 cc

# Domain3
# Desc3
# esriFieldTypeInteger
# 0
# 100

make sure you've got python's ogr package installed.

Furthermore, as I explored his blog, I found a more encompassing tool he made for exploring ESRI GDB's properties. This tool makes an HTML report of the GDB's properties. Make sure you follow his instructions in the tool's repository


Domains will be supported in GDAL 3.3 and they are already available in the current development version (the "main" branch). See https://gdal.org/drivers/vector/openfilegdb.html#vector-openfilegdb

Field domains

(GDAL >= 3.3) Coded and range field domains are supported.

The domain support has been added into FileGDB and OpenFileGDB drivers and also to the GeoPackage driver. I fear that the details must be learned from the pull request https://github.com/OSGeo/gdal/pull/3638.


I am not sure if GeoCat Bridge can help you. What I know about this software is it can translate mxd and other tricky ArcGIS data files to other FOSS4GIS softwares. There are some information here: https://www.youtube.com/watch?v=uEAchftdDVA Please keep us informed of your results if you test that solution.

  • Thank you for the suggestion @Gabriel Asato. There's one major problem: It's proprietary (and too expensive for me). Moreover I think this service focuses mainly in converting projects into spatial web services such as Geoserver.
    – EranGeo
    Commented Jun 9, 2019 at 8:52

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.