GDAL – Using GDAL Python Bindings and File Geodatabase API

file-geodatabasegdalpython-2.7

I'm trying to get python 2.7 to work with GDAL/OGR and an ESRI file geodatabase. There have been a few similar questions asked but the answers don't fully resolve my situation.

I have installed the 64-bit GDAL Core files from Link I have also installed the Python Bindings and the File GDB.

The background to the problem is that when I run ogrinfo –formats from the command line it returns: "FileGDB" (read/write), when I run ogr from the command line I can see the layers in the Geodatabase BUT when I try to use the following code in Python in returns "None"

driver = gdal.GetDriverByName('FileGDB')
ds = driver.Open(r"my file.gdb",0)
print driver

Ogr definitely works in python because the following code returns the correct response:

driver = ogr.GetDriverByName("ESRI Shapefile")
ds = driver.Open(r"My Shapefile.shp",0)
print ds

driver = gdal.GetDriverByName('GTiff')
ds = driver.Open(r"My GeoTiff.shp",0)
print driver

Does anybody have any pointers to resolve this.

Thanks

Best Answer

I found the solution to this was to add GDAL_DRIVER_PATH = C:\Program Files\GDAL\gdalplugins in the Environment Variables.

This was in addition to Mike Toews comment about the correct usage being ogr.GetDriverByName('FileGDB')