Installing File Geodatabase (*.gdb) support in QGIS?
Update December 2017
Now you can simply drag&drop .gdb file (directory) into QGIS. This is read access to File Geodatabases only. If you require write access please read further.
Update July 2015
It is time to bring this answer a bit more current as some elements of FileGDB support in QGIS have changed. I am now running QGIS 2.10.0 - Pisa. It was installed using the OSGeo4W installer.
What has changed is that upon the basic install of QGIS, File GDB read-only access is enabled by default, using the Open FileGDB driver. Credit for first noting this must be given to @SaultDon.
Read/Write access may be enabled using the FileGDB driver install through the OGR_FileGDB library. The library needs to be enabled using the process below, either when you install QGIS, or individually. More detail about the drivers is below:
- FileGDB driver: Uses the FileDB API SDK from ESRI - Read/Write to FGDB's of ArcGIS 10 and above
- OpenFleGDB driver: Available in GDAL >= 1.11 - Read Only access to FGDB's of ArcGIS 9 and above
When you add a Vector Layer, you simply choose the Source Type
based on the driver you want to use.
ESRI FileGDB Driver
Open FileGDB Driver
The process below shows in more detail the steps to install QGIS from the OSGeo4W installer, ensure the OGR_FileGDB library is installed, then load layers from a File Geodatabase.
Download and run
osgeo4w-setup-x86.exe
for 32bit orosgeo42-setup-x86_64.exe
for 64bit from OSGeo4W.Choose Advanced Install, then Install from Internet. Choose your root and local package directories, and then your connection type, in my case, "Direct Connection". Once you click next, it will bring up a screen with a number of collapsed menus.
Expand the "Desktop" menu. Find the entry for "qgis: Quantum GIS (desktop)". In the "New" column, change entry from "Skip", to show version 2.10.0-1.
Expand the "Libs" menu. Find the entry for "gdal-filegdb: OGR FileGDB Driver". In the "New" column, change the entry from "Skip", to show version 1.11.2-1.
Once you click Next, it will install QGIS and all of the associated libraries. Once this is completed, open Quantum GIS, and Choose "Add Vector Data". Change the option to "Directory". This is where you choose the driver as shown above.
Browse to the File Geodatabase and select the directory. Click "Open"
Select a Vector Layer and press "Ok". Please note that the FileGDB API Does not support Raster Images.
As you can see, the selected layer loads in. Using the Esri driver, editing is possible. If you use the Open FileGDB driver, the data is read only.
For your reference, here is the "About" window from my install of QGIS, showing the versions of the software, and the GDAL/OGR library being used.
This install was performed on a Windows 7 64bit computer. With previous installers, there were some inconsistent results. This may have changed with the switch to the 32 or 64bit installers. This thread at OSGeo discusses some old issues people were experiencing: Thread
If you have QGIS running and compiled against GDAL 1.11.0, it now has native FileGDB support via the OpenFileGDB driver.
To open a geodatabase in QGIS, be sure to choose "Add vector layer", "Source Type = Directory" and source should be either "OpenFileGDB" or "ESRI FileGDB". Then just browse to the *.gdb folder of choice, press "Open" and the layers will be loaded into your Table of Contents.
There are some current limitations like not being able to write to a FileGDB, but it supports FileGDBs <= 10.0 which is quite a bonus and "custom projections".
The work-in-progress reverse-engineered specification is available on GitHub for the OpenFileGDB driver.
If you are on a Mac you can compile the filegdb driver from scratch using these instructions.
UPDATE: It has been 2 years since this answer, you may want to try this now: https://github.com/OSGeo/homebrew-osgeo4mac Also, as many say now, you can use the OpenFileGDB driver which does not use the ESRI binaries to accomplish this. Please be mindful that it is a project that has reversed-engineered how the spec works and not ESRI sanctioned (still is great to have alternatives and it represents amazing work).