184

I have spent around 2 days to find the way to open GDB (ESRI Geodatabase) in QGIS (or any other open source software) but still without success.

I have downloaded the newest OSGeo4W installer and tried the setup - express desktop install - all packages, as well as advanced install incl gdal-filegdb.

Can you describe a more detailed procedure, including installation and how to open .gdb in QGIS (OSGeo4W installation)?

Taras
  • 32,823
  • 4
  • 66
  • 137
Miro
  • 9,744
  • 8
  • 49
  • 87

7 Answers7

213

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 Esri FileGDB Driver

Open 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.

  1. Download and run osgeo4w-setup-x86.exe for 32bit or osgeo42-setup-x86_64.exe for 64bit from OSGeo4W.

  2. 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. Select Installation Packages

  3. 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. Choose QGIS install entry

  4. 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. Select GDAL File GDB Driver

  5. 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. Choose FileGDB directory and driver

  6. Browse to the File Geodatabase and select the directory. Click "Open" Select File GDB location

  7. Select a Vector Layer and press "Ok". Please note that the FileGDB API Does not support Raster Images. Select Vector Layer

  8. 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. Loaded vector layer in QGIS

  9. 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. QGIS About Window

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

Miro
  • 9,744
  • 8
  • 49
  • 87
Get Spatial
  • 13,259
  • 6
  • 41
  • 68
  • @mattwilkie - I don't know if this makes a difference, but what is the file version of your FileGDBAPI.dll? Mine is 1.2.0.136. What happens when you try to open a .gdb directory? – Get Spatial May 28 '12 at 19:18
  • My file version is same, last modified 23-Feb-2012 2:20pm, 4,616,048 bytes.I'm told "test.gdb is not a valid data source" (using directory type). I see from here that others have had trouble reliably getting the ability to open file-gdb's in qgis installed by osgeo4w. I also tried copying FileGDBAPI.dll to the qgis bin directory and ogr_FileGDB.dll to the qgis gdalplugins directory as per here. – matt wilkie May 28 '12 at 19:31
  • Just to be clear, I am using the OSGeo4W installation. I wanted to verify where both of those files were located. The FileGDBAPI.dll file is located at C:\OSGeo4W\bin. The ogr_FileGDB.dll is located at C:\OSGeo4W\bin\gdalplugins\1.9. I am actually going to do an uninstall of my OSGeo4W and do an install of standalone QGIS to see if I can get it to work with that. I'll post my results. – Get Spatial May 28 '12 at 19:47
  • @mattwilkie, To update: I completely uninstalled the OSGeo4W package, including deleting the entire install folder, and the download directory with cached files. I tried for 2 hours to use standalone QGIS and GDAL libraries to install, but because I don't know how to compile software, I could not get the FGDB extension added that way. Reinstalled OSGeo4W from scratch. After enabling only QGIS under Desktop programs and adding gdal-filegdb driver under Libs, it works. Only thing I can think of is File GDB must be ArcGIS version 10, 9.3.1 is not supported. – Get Spatial May 28 '12 at 23:50
  • @mattwilkie, I'm going to edit my answer because as you said, the necessary dll's are included with the OSGeo4W download. Please note this is all being tested on a Windows 7, 64 Bit machine. – Get Spatial May 28 '12 at 23:55
  • Followed this but still not successful. To make it clear - all I need is to install latest OSGeo4W (Express Desktop Install - check all including GDAL)? Or do I have to also use advanced instalation to make sure that FileGDBAPI.dll is in the C:\OSGeo4W\bin? I also copied FileGDBAPI.dll into C:\OSGeo4W\apps\qgis\bin. Also copied all 6 files which I have downloaded in package from ESRI (bin) and also tried once with all files from "bin64" to both directories just to make sure :-). Anyway thank you very much for help, going to reainstall the whole thing once again... – Miro May 29 '12 at 01:02
  • thank you for going to such lengths to help try and get to the bottom of this. My system is also win7x64, and I tested with Arcgis 10 gdb's. I'll try and borrow a fresh machine and install from scratch, my computer has been in use for a few years and definitely no longer resembles an out of the box configuration. ;-) – matt wilkie May 29 '12 at 19:11
  • Thank you very much. I have uninstalled everything, installed this way and it works. Unfortunatelly not with data I need to open (they are probably in .GDB 9.x version format). With Small test fgdb with points, lines, polygons from http://trac.osgeo.org/gdal/wiki/FileGDB it went smooth. If it is possible, it would be good to know how to open older format (9.x) - convert it somehow to version 10 or anything to make it work. Anyway thank you again for detailed instructions. – Miro May 30 '12 at 04:12
  • @Miro, as far as I know, there is no API access to File GDB's that are in the ArcGIS 9.X format. I think your best bet might be, if this is feasible, to create a new Version 10 FGDB and copy everything from the older version into it. Assuming you only have basic feature classes, and possibly relationship classes, there shouldn't be a problem moving data between versions. Glad you were able to get it working! – Get Spatial May 30 '12 at 04:16
  • @miro, if you don't have Arcgis v10 I'm happy to upgrade the gdb for you. It's a trifling matter and only takes a few moments -- when the tools are in hand, much harder when not. Contact me via the email in my profile. – matt wilkie May 30 '12 at 16:21
  • @mattwilkie, were you able to get this working on one of your computers? I haven't had time to work on it more the last couple of days, but hope to later this week. Mostly, I want to see if I can get it working using the standalone QGIS installer separately from the OSGeo4W setup. – Get Spatial May 30 '12 at 16:30
  • AHA! If I use ArcCatalog (v10 service pack 4) and create a new f-gdb, qgis says it's an invalid data source. If I import some our data into it, qgis says it's no good. However, if I copy something from the test_fgdb on the Osgeo4w website into it, qgis can see the test data! It still doesn't see my data though. ArcCatalog on the other hand shows all the data, mine and the o4w test data. Further testing from the commandline reveals that ogrinfo doesn't see our data either, though it does say using driverFileGDB' successful.`. It's a bug. – matt wilkie May 31 '12 at 19:26
  • @mattwilkie - Wow, glad you were able to figure it out. It must be related specifically to Service Pack 4 as well. – Get Spatial May 31 '12 at 19:35
  • @mattwilkie, Oh, that is fantastic. I wouldn't hold out hope of getting it fixed either, considering what seems to be the stance on raster support for the SDK. I added my vote. If you don't mind, I'm going to edit my answer above to incorporate info about this limitation. – Get Spatial May 31 '12 at 19:59
  • @mattwilkie Thank you, at the end I have installed trial version of ArcGIS to export it. Hopefully soon in future open API will remove these problems. Also voted on that FileGDB API should support custom coordinate systems link. Thanks again. – Miro Jun 07 '12 at 23:38
  • Brilliant! works like a charm :-) Now if I can only get it to export from fdgb to postgis without issues. See http://gis.stackexchange.com/questions/29854/ogr2ogr-when-importing-from-fgdb-and-use-in-python#comment40089_29854 – GeorgeC Jul 23 '12 at 01:34
  • Has anyone had success with FileGDB using the OSGeo4W "QGIS-FULL" installation--their QGIS installation including all default sets of packages. To get the default setup with GRASS,SID driver, Python etc you simply use the OSGeo4W ADVANCED INSTALL. Start by skipping everything in all categories, then under DESKTOP packages select the 1K "qgis-full desktop meta package" QGIS and recommended packages are then automatically marked. THEN manually select, under LIBS category, the "gdal filegdb ogr driver. Someone who can, please do a test run and report back or copy this as "Your Answer" below. – user12711 Jan 24 '13 at 14:43
  • Is there a reason I cannot install packages as stated in step 3 above for QGIS 1.8 Lisboa? The current executable only allows the packages for 2.2.0 as shown in step 3 above. If the executable for QGIS 1.8 Lisboa is not available I'll just install 2.2.0 and go from there. – danagerous Apr 02 '14 at 17:13
  • 1
    Can QGIS handle ESRI FGDB files that contain rasters instead of shapefiles? I have downloaded a FGDB file that I have opened in ArcGIS, which shows up like a raster but in QGIS 3.0 (drap-drop) it opens as a vector (with only one single non-classified polygon). Source: https://www.donneesquebec.ca/recherche/fr/dataset/utilisation-du-territoire/resource/50c5fbc1-68c4-4c46-a663-f806a4515031 – user3386170 Nov 27 '18 at 15:10
  • 1
    @user3386170 Unfortunately, the FGDB API does not support raster. I provided a link in point 7 of the workflow above. – Get Spatial Nov 30 '18 at 00:42
54

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.

RyanKDalton
  • 23,068
  • 17
  • 110
  • 178
SaultDon
  • 10,389
  • 1
  • 43
  • 78
17

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).

Ragi Yaser Burhum
  • 15,339
  • 2
  • 59
  • 76
7
  • Download and run OSGEO4W setup (I'd suggest the 32 bit version)

  • Run it once using the Desktop Installation option, to install QGIS (and whatever other desktop programs you want).

  • After that's all done, run OSGEO4W setup again from the Start menu, choose Advanced installation, and proceed to the part of setup where you select packages. Scroll down to the "gdal-filegdb" package and click where it says "Keep" in this screenshot:

enter image description here

It says "Keep" there because I already have the package installed, you will want to click it until the text there matches the "Current" number to the left of it.

  • Click Next, you'll need to agree to some license terms, then finish the installation and you're done.
Dan C
  • 12,212
  • 11
  • 57
  • 86
6

i had a related problem/question some 3 months ago (see: qgis 2.8.1 arcgis filegdb incomplete list in win-version)

a few days ago i've switched from 2.8.x to 2.10.1-Pisa hoping to get rid of the file geodatabase issues discribed in my question. unfortunately without beeing successfully.

what i've figured out since then is: there still seems to be a problem with custom coordinate systems ! my tests with a filegdb created with arcgis 10.1 and another one with arcgis 10.3 on different pcs show that trying to open a filegdb that just contains feature classes with custom CRS returns the following error:
"Invalid Data Source: D:\xxxx\yyy\zzzz.gdb is not a valid or recognized data source"

... both drivers (FileGDB driver, OpenFileGDB driver) return the same error !
while Can FileGDB SDK be made to support custom coordinate systems? article and some of the comments/answers here state that custom CRC support via OpenFileGDB is implemented - it doesn't work on my systems (gdal-filegdb: OGR FileGDB Driver 1.11.2-1)

if the filegdb contains any tables - just these tables are displayed in "select vector layers to add ..." list and mixing custom CRC- and non-custom data with looks like this

arccatalog:

filegdb content arccatalog

qgis 2.10:

filegdb content qgis (FileGDB driver and OpenFileGDB driver)

my personal conclusion: always use standard CRCs ! ! !

robert tuw
  • 898
  • 1
  • 9
  • 20
6

It is nice, in 2019, you do not need do above, it is already supported in qgis 3.6.

Simple and easy by 3 steps:

Step 1: click the add vector button (red circle)

enter image description here


Step 2: select directory, openFileGDB, and file path (red arrow)

enter image description here


Step 3: select all layers (red circle) enter image description here


Done!!!!! You just add all layers to qgis

hoogw
  • 1,712
  • 1
  • 18
  • 23
3

For macOS Mojave (10.14) users with QGIS 3.X, install the fileGDB GDAL driver using Homebrew from osgeo4mac, then appropriately link the path to point to the gdalplugins directory used by QGIS:

  1. brew tap osgeo/osgeo4mac
  2. brew install osgeo-gdal-filegdb
  3. Note the plugin directory displayed by Homebrew: console output of successful osgeo-gdal-filegdb install

  4. Verify a successful install by running ogrinfo --formats and verify that FileGDB is listed: console output showing FileGDB format supported

  5. Link the compiled driver file into the appropriate gdalplugins directory.

The preferred way to do this is to create a symlink (ln -s source_file dest_file) from the compiled ogr_FileGDB.dylib to within the QGIS Application Package.

In my case: ln -s /usr/local/Cellar/osgeo-gdal-filegdb/2.4.1_1/lib/gdalplugins/2.4/ogr_FileGDB.dylib /Applications/QGIS3.4.app/Contents/Resources/gdal/gdalplugins/2.4

Alternatively, in QGIS 3.X, go to Preferences --> System --> Environment and create a custom variable called GDAL_DRIVER_PATH set to the directory provided by Homebrew (in my case, /usr/local/lib/gdalplugins). Beware that this approach will break any other GDAL plugins within the QGIS Application Package. After restarting, you should see this variable show up in bold in the "Current environment variables" section: QGIS screenshot showing GDAL_DRIVER_PATH environmental variable

You should now see ESRI FileGDB in your list of Vector Directory data source types, and also be able to Export layers as FileGBD types: enter image description here

Mark Egge
  • 169
  • 3