How to add support for FileGDB (Esri file gdb API) driver in fiona?

The Gohlke GDAL/OGR wheel includes the FileGDB driver compiled as a plugin.

To get the FileGDB driver working:

  1. Copy the Esri bin64\FileGDB.dll to [python install/virtualenv dir]\Lib\site-packages\osgeo (use bin\FileGDB.dll if using 32bit python). Do not copy the FileGDB.dll to the gdalplugins directory.
  2. Set GDAL_DRIVER_PATH environment variable, either:
    • manually; or
    • edit [python install/virtualenv dir]\Lib\site-packages\osgeo\__init__.py and uncomment line 10.
      # uncomment the next line to enable plugins
      os.environ['GDAL_DRIVER_PATH'] = os.path.join(os.path.dirname(__file__), 'gdalplugins')

Opening a GDB with the FileGDB driver should now work.

>>> import fiona
>>> with fiona.drivers():
...     with fiona.open(path=r'C:\Temp\Default.gdb', driver='FileGDB') as source:
...         print(source.meta)
...
{'crs': {'init': u'epsg:4326'}, 'driver': 'FileGDB', 'crs_wkt': u'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01
74532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]', 'schema': {'geometry': 'MultiPolygon', 'properties': OrderedDict([(u'SHAPE_Length', 'float'), (u'SHAPE_Area', 'float')])}}
>>>

Note:

Using Python 2.7 I could only get FileGDB plugin to work with the FileGDB API v1.3 (MSVC 2008). as v.1.4 segfaults python. I assume this is because python and the GDAL and Fiona libraries provided by Gohlke are compiled with MSVC 2008 and v. 1.4 is compiled with MSVC 2010 (and later).

The FileGDB API v1.4 works fine with Python 3.4 and the GDAL and Fiona libraries provided by Gohlke which are compiled with MSVC 2010.


The key information is here:

I am also able to get OGR formats: ogrinfo --formats prints a bunch of them in the Windows cmd (with no FileGDB there though).

This tells me that your GDAL_DRIVER_PATH environment variable is not set. See the instructions at https://trac.osgeo.org/gdal/wiki/FileGDB#Testingthedriver. Once "FileGDB" shows in ogrinfo --formats (or fio env --formats), you'll be good to go.