Created
July 26, 2013 13:45
-
-
Save gislars/6088964 to your computer and use it in GitHub Desktop.
Howto use gdal/ogr to access a FileGDB and convert it to shapefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get the FileGDB API http://www.esri.com/apps/products/download/ | |
extract it somewhere on your system and remember the path :) | |
mkdir build #directory where we are playing around | |
cd build | |
git clone https://github.com/OSGeo/gdal.git | |
cd gdal | |
./configure --with-fgdb=/path/to/your/FileGDB_API | |
make | |
(make install) optional, I'm just using it locally | |
note: you will need all the dependencies, development files as well as all the compile tools. I don't dig into this topic here, but if somebody has trouble, I might be able to help. | |
First test: | |
build/gdal/apps/ogrinfo --formats #I have to use absolute paths, since I didn't install gdal system wide | |
if you are lucky you will see a output like this: | |
Supported Formats: | |
... | |
-> "FileGDB" (read/write) | |
... | |
Now you can use ogrinfo or ogr2ogr to access your FileGDB | |
build/gdal/apps/ogrinfo /path/to/your/database.gdb <layername> -summary | |
convert a FileGDB to Shapefile: | |
build/gdal/apps/ogrinfo -f "ESRI Shapefile" <out_directory> /path/to/your/database.gdb | |
A directory will be created and for each layer within the filegdb a shapefile set will be created. | |
You could also use a query to retrieve a subset of your filegdb. There is an example on the gdal site http://www.gdal.org/ogrinfo.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, the previous comment is correct, it should be ogr2ogr on line #30