Installing File Geodatabase (*.gdb) support in QGIS?
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)?
First I have installed osgeo4w-setup - Express desktop install - which I guess download the **newest library** for instalation. In "Advanced Install" I tried **gdal 1.9.1-RC2-1 and 1.9.0-3**. Talking about **gdal-filegdb** there is only **1.9.0-1** version at this moment.
Well this may be the problem - _"File GDB must be ArcGIS version 10, 9.3.1 is not supported."_ - I don't know the version of ESRI File Geodatabase (FileGDB), I just got data. Going to find and test some data in version 10 with my install and let know.
Ok, tried with _"test_fgdb.gdb"_ from http://trac.osgeo.org/gdal/wiki/FileGDB and still got message _"test_fgdb.gdb is not a valid or recognized data source"_.
I found "Get Spatials" answer addressed this question for me. I however did not need to delete all my GIS software (or even OSGeo-4W) before installing OSGEo-4W with the advanced settings. I also noted that some of the numbers have changed (no doubt due to version updates to gdal and QGIS). Another interesting thing I noticed different was that the "add vector layer" window now has a source type "ESRI FileGDB", this came up as the default for me when I selected a source type "Directory". Otherwise thanks Get Spatial. This solution worked on my Windows XP Pro with 32 bit.
Have you tried following the steps and seeing how far you get? Just because the link is two years old doesn't mean that it isn't still relevant. As far as I can recall the install for 2.0.1 is very similar if not the same to the instructions in the answer.
@jeff - This process should be essentially the same for the current versions of the OSGeo4W installer, QGIS and the File GDB support. As Peter's comment above suggests, version numbers have changed, and the type comes up as a default for the "Directory" source type now. Other than that, should be relevant. Now that it has been a while, drop a comment if it worked for you, or if you had a problem.
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 Typebased 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.exefor 32bit or
osgeo42-setup-x86_64.exefor 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
`FileGDBAPI.dll` is part of the `gdal-filegdb` package and should already be installed in `%osgeo4w_root%\bin`. Unfortunately, that alone is not enough on my system either.
@mattwilkie - I don't know if this makes a difference, but what is the file version of your FileGDBAPI.dll? Mine is 220.127.116.11. What happens when you try to open a .gdb directory?
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.
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.
@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.
@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.
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...
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. ;-)
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, 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!
@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.
@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.
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 driver `FileGDB' successful.`. It's a bug.
@mattwilkie - Wow, glad you were able to figure it out. It must be related specifically to Service Pack 4 as well.
found the bug, and it's a whopper: The FileGDB SDK **doesn't support custom coordinate systems** (gdal #4578). One hopes that is not a long lived limitation; vote for fixing it at http://ideas.arcgis.com/ideaView?id=087E00000004DpoIAE
@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.
@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.
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
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.
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 - This answer was written when QGIS `1.8` was the current install version. As you have shown, the current version is now up to `2.2.0`. The process and steps to ensure that the library is installed remain the same, but you would always want to use the most current version available for both `QGIS` and the `gdal-fgdb` library.
Very nice, thank you....docs like this are essential when you just need to be up and running immediately.
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