FileGDB
Table of Contents
- http://www.gdal.org/drv_filegdb.html
- initial discussion on gdal-dev mailing list: read here
- Also see the OpenFileGDB driver: http://gdal.org/drv_openfilegdb.html
Build GDAL with FileGDB Support
Download the API / SDK
- Latest SDK: see list at https://github.com/Esri/file-geodatabase-api
- older releases: http://www.esri.com/apps/products/download/#File_Geodatabase_API_1.4 (you will need an 'ESRI Global Account')
Compile
Windows (Visual Studio 2008) - FileGDB driver as a plugin
You may compile filegdb as a plugin for GDAL:
- Compile GDAL with the FGDB section commented
- Now edit your nmake.opt (or add it in nmake.local) so it contains something like the following (pay attention to the FGDB_SDK path):
FGDB_ENABLED = YES FGDB_PLUGIN = YES FGDB_SDK = $(GDAL_HOME)\..\FileGDB_API_VS2008_1_0Final FGDB_INC = $(FGDB_SDK)\include FGDB_LIB = $(FGDB_SDK)\lib\FileGDBAPI.lib
- Next, cd to the /ogr/ogrsf_frmts/filegdb directory
- Execute the following:
nmake /f makefile.vc plugin
A file named ogr_FileGDB.dll should be generated.
- You will also need the file: FileGDB_API_VS2008_1_0Final/bin/FileGDBAPI.dll
Windows (Visual Studio 2008) - FileGDB driver built inside gdalXX.dll
- Edit your nmake.opt (or add it in nmake.local) so it contains something like the following (pay attention to the FGDB_SDK path and let FGDB_PLUGIN commented):
FGDB_ENABLED = YES #FGDB_PLUGIN = YES FGDB_SDK = $(GDAL_HOME)\..\FileGDB_API_VS2008_1_0Final FGDB_INC = $(FGDB_SDK)\include FGDB_LIB = $(FGDB_SDK)\lib\FileGDBAPI.lib
- Compile GDAL
- You will also need the file: FileGDB_API_VS2008_1_0Final/bin/FileGDBAPI.dll
Unix (Tested on Ubuntu 8.04 and trunk 22708)
FileGDB is supported through ./configure
Assuming you've installed libFileGDBAPI library under the default location, the procedure of adding FileGDB support to GDAL/OGR is relatively simple.
First, you need to append the FileGDB_API path (e.g., /usr/local/FileGDB_API/lib) to /etc/ld.so.conf. Next, update the dynamic linker with: sudo ldconfig. Finally, provide GDAL/OGR configure with the path to the FileGDB installation (replace /usr/local/FileGDB_API with whereever you extracted FileGDB_API_<version>.tar.gz) prefix:
$ cd /path/to/gdal $ ./configure --with-fgdb=/usr/local/FileGDB_API $ make # make install
How to deal with GCC >= 5.1 C++11 ABI on Linux
Starting with GCC 5.1, GCC links against libstdc++ using the C++11 ABI. This cause issues with FileGDB ABI SDK <= 1.4 which are provided using the old C++ ABI.
You'll get linking issues such as
.libs/libgdal.so: undefined reference to `FileGDBAPI::Geodatabase::Delete(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)' .libs/libgdal.so: undefined reference to `FileGDBAPI::Row::SetFloat(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, float)'
Proper solution: use the FileGDB_API_1_5_32gcc51.tar.gz or FileGDB_API_1_5_64gcc51.tar.gz packages from https://github.com/Esri/file-geodatabase-api/tree/master/FileGDB_API_1.5
With earlier version, to workaround the link issues, run configure with:
$ CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" ./configure --with-fgdb=/usr/local/FileGDB_API
Note that by doing so, you might have issues if using C++ gdal dependencies built with the new ABI, or if using GDAL in a C++ software built with the new ABI. So update to FileGDB API 1.5 GCC51 packages is strongly recommended.
Compiling GDAL 2.3+
GDAL 2.3 switched to C++11 compilation mode by default, which means that on Windows, Microsoft Visual Studio 2015 (VC14) or greater must be used. You may need to enable ATL and Windows 10 SDK during install to ensure all the necessary include files are available.
Building plugins with Conda
An example recipe for building a libgdal-filegdb
plugin can be found here on osgeo-forge. This can be installed alongside a GDAL package such as the one found in the conda-forge
channel to provide FileGDB support. It requires the filegdb-api
package, the recipe for which can be found here.
Testing the driver
To test if the driver is been loaded, make sure that the path to ogr_FileGDB.dll is defined with the GDAL_DRIVER_PATH environmenet variable and FileGDBAPI.dll is found in your path, and then execute the following (look for "FileGDB" in the results):
.\> ogrinfo --formats Supported Formats: -> "FileGDB" (read/write) -> "ESRI Shapefile" (read/write) -> "MapInfo File" (read/write) -> "UK .NTF" (readonly) -> "SDTS" (readonly) -> "TIGER" (read/write) -> "S57" (read/write) -> "DGN" (read/write) -> "VRT" (readonly) -> "REC" (readonly)
Note for Unix when note compiled as plugin: The order in supported formats (and I think order in which drivers are attempted) is slightly different.
$ ogrinfo --formats Supported Formats: ... -> "PostgreSQL" (read/write) -> "PCIDSK" (read/write) -> "FileGDB" (read/write) -> "XPlane" (readonly) ...
Then test with a sample file (such as here):
ogrinfo test_fgdb.gdb INFO: Open of `test_fgdb.gdb' using driver `FileGDB' successful. 1: basetable_2 (None) 2: basetable (None) 3: base_table1 (None) 4: test_lines (3D Multi Line String) 5: more_test_lines (3D Multi Line String) 6: test_points (3D Point) 7: test_areas (3D Multi Polygon)
Note: FileGDB_API 1.0 only supports a FileGDB created with ArcGIS>=10.0. If you try accessing a FileGDB created with an earlier ArcGIS version you will get the following error:
ERROR 1: Error: Failed to open Geodatabase (This release of the GeoDatabase is either invalid or out of date.)
Open Tickets
(May also show tickets about ArcObjects Driver which can also read FileGDB but requires an ArcObjects license) No results
Attachments (1)
-
test_fgdb.gdb.zip
(99.1 KB
) - added by 12 years ago.
Small test fgdb with points, lines, polygons.
Download all attachments as: .zip