There has been a tons of questions on that but none of them solved my problem.
I have a machine with:
- Windows 7 x64
- Python 3.4.3 x64
- gdal installed:
gdalinfo --version --> GDAL 1.11.4, released 2016/01/25
; gdal was installed from a wheelGDAL-1.11.4-cp34-none-win_amd64.whl
from here
The GDAL is installed into C:\Python34\Lib\site-packages\osgeo
. There I have a bunch of .exe files for gdal and ogr and .pyd files.
- fiona installed: was installed from a wheel
Fiona-1.6.3-cp34-none-win_amd64.whl
, from the same website.
I am able to run this code and it executes successfully:
import gdal
import ogr
from gdalconst import *
shp = r"C:\Data\GIS\PTS.shp"
driver = ogr.GetDriverByName('ESRI Shapefile')
dataset = driver.Open(shp)
layer = dataset.GetLayer()
layer.GetFeatureCount()
schema = layer.schema
fields = [field.GetName() for field in schema]
feature = layer.GetNextFeature()
I am also able to get OGR formats: ogrinfo --formats
prints a bunch of them in the Windows cmd (with no FileGDB there though).
I am able to run this code and it executes successfully:
import fiona
with fiona.drivers():
with fiona.open(path=r'C:\Data\GIS\TemplateData.gdb', driver='OpenFileGDB') as source:
print(source.meta)
However, this code won't run:
with fiona.drivers():
with fiona.open(path=r'C:\Data\GIS\TemplateData.gdb', driver='FileGDB') as source:
print(source.meta)
Because I don't have Esri File GDB compiled libraries which are required.
I have downloaded and unpacked FileGDB_API_VS2012_1_3.zip
from the Esri downloads page. As I understood, there is no need to compile anything as the .dll is already there.
What is the correct procedure to register the dll of the Esri File GDB API to be able to use them in fiona in my environment?
UPDATE: (based on Luke's answer)
I have downloaded the File Geodatabase API 1.4 version for Windows (Visual Studio 2010)
from the Esri downloads page. I copied the FileGDB_API_VS2010_1_4\bin64\FileGDBAPI.dll
to the C:\Python34\Lib\site-packages\osgeo
. Now I have two files in here, ogr_FileGDB.dll
and FileGDBAPI.dll
.
I have created a Windows variable GDAL_DRIVER_PATH : C:\Python34\Lib\site-packages\osgeo\gdalplugins
. In the PATH
variable, I don't have anything Python specific except the C:\Python34\Lib\site-packages\osgeo
.
Now when running the ogrinfo --formats
I get -> "FileGDB" (read/write)
and am able to use the Python code for working with the FileGDB driver.
[python install dir]\Lib\site-packages\osgeo
dir as I specified in my answer, not the gdalplugins dir you mention in your edit. Only driver plugins go in that directory, not 3rd party dlls.