Is there a way to tweak the fiona/gdal/osgeo packages installed through Anaconda so that they can be used to read/write GDB files using the ESRI FileGDB driver?
I have found multiple answers online, but all of them involve re-installing OSGeo or GDAL from the python wheel files. These methods do not work for me because I installed fiona, OSGeo and GDAL using Anaconda. So none the solutions I found online (listed below) seem to work.
I have already downloaded the DLL file from ESRI, placed it in my
C:\...\Lib\site-packages\osgeo folder and added a new environment variable called
GDAL_DRIVER_PATH indicating the appropriate path. However, contrary to the suggestions in the posts listed below, the
__init__.py inside the
osgeo folder does not have a commented line that reads
os.environ['GDAL_DRIVER_PATH'] = os.path.join(os.path.dirname(__file__), 'gdalplugins'). Therefore, I am not sure where to include this line in my own file system.
Here is a list of related posts/questions/sites with relevant info but which ultimately did not solve my problem.
- How to add support for FileGDB (Esri file gdb API) driver in fiona?
- How to edit file geodatabase in Python using FileGDB Driver?
- Geopandas: Write layer back into GeoDataBase
- Exporting PostGIS Data
- Setting up GDAL/OGR with FileGDB Driver for Python on Windows
- GDAL FileGDB Driver with Anaconda / ArcGIS Pro (Unanswered)
- GDAL Documentation on using ESRI File Geodatabase (FileGDB)
- How to access feature classes in file geodatabases with Python and GDAL?
- ESRI FileGDB API on GitHub
How I installed Fiona and other packages:
I'm currently using Windows 10. After installing Anaconda, I created a new environment called
myenv and installed the main libraries I was going to use:
conda create -n myenv pandas geopandas fiona spyder numpy scipy
GDAL was automatically installed as one of the associated/required packages for fiona and geopandas.
In my command prompt, when I activate
myenv and type
gdalinfo --version, I get the following response:
GDAL 3.0.2, released 2019/10/28
When I use the python-based route, I get the same answer.
import osgeo.gdal print(osgeo.gdal.__version__) >3.0.2