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?


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


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 Jun 9 '19 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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