Can you tell me how I can load geodatabase data into PostGIS without having to install Esri apps?
The solution I found online talked about using ArcGIS to convert GDB to SHP and then importing SHP to PostGIS.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityCan you tell me how I can load geodatabase data into PostGIS without having to install Esri apps?
The solution I found online talked about using ArcGIS to convert GDB to SHP and then importing SHP to PostGIS.
I do it all the time for my clients.
Dump your data to FileGDB or Shapefiles then execute the following command:
For ESRI Shapefiles:
ogr2ogr -f "PostgreSQL" PG:"dbname=mydbname user=postgres" myshapefile.shp
For FileGDB:
ogr2ogr -f "PostgreSQL" PG:"dbname=mydbname user=postgres" myFileGDB.gdb
For FileGDB, you need to make sure that the FileGDB driver is installed. You do it with:
ogrinfo --formats
which should show FileGDB somewhere to tell you it is installed.
ogr2ogr -f "PostgreSQL" PG:"dbname=mydbname user=postgres" SanDiegoData.gdb -sql "GetLayerDefinition Parcels"
would dump the ESRI XML metadata to a field in that db
– Ragi Yaser Burhum
May 31 '16 at 17:25
I haven't tried this so can't verify it works, but the File Geodatabase API may allow you to export the data from file Geodatabase to SHP (and thence PostGIS). The documentation says:
With the API you can... Read and write data
The Esri file geodatabase API only works with file geodatabases created using 10.x - the older versions will not work with GDAL, QGIS or anything else that depends on the open file geodatabase API. The old Personal Geodatabases depend on MS Access and there are readers and code available.
If you have a 10.x file geodatabase you can read layer from FileGDB and load into PostGIS with a single ogr2ogr command (see documentation):
ogr2ogr -overwrite -skipfailures -f "PostgreSQL" PG:"host=myhost user=myuser dbname=mydb password=mypass" "C:\somefolder\BigFileGDB.gdb" "MyFeatureClass"
In order to do this I also had to download VS2010 express edition and build my own GDAL, ogr plugin and 1.3 of the open file geodatabase API.
What I have been unable to do is migrate an older 9.x file geodatabase without using esri software (not available to me atm) - I cannot get past the...
HRESULT=-2147220965, errorText="This release of the GeoDatabase is either invalid or out of date."
...when trying to open the 9.x "gdb" with the open API that only supports 10.x "gdb".
While I have not tried it yet myself, I did just come across this tutorial (which is shapefile-->PostGIS) that uses the open-source geoETL software called "Spatial Data Integrator". I'm not sure if it supports Esri GDB or not, but it might be worth investigating further to see if you can use this product to make the similar conversion from GDB to PostGIS without using ESRI products.
Other ETL packages that I have heard of are FME from Safe Sofware ($, very popular) and GeoKettle (open-source), as well as many more references on the Spatial ETL wikipedia page.
EDIT: Upon digging a bit further, it looks like SDI does not directly support read of EsriGDB, but can read available OGR file formats.
FWIW work is going on to create a GDB to postgis loader. This depends on latest GDAL trunk which has GDB bindings. Haven't had a chance to compile and try myself but hope to before PostGIS 2.0 is out.
check out - http://trac.osgeo.org/postgis/browser/spike/pramsey/postgis2fgdb
You can probably give Paul a buzz on PostGIS newsgroup to find out where he is with this. http://www.postgis.org/mailman/listinfo/postgis-users
For the Personal GeoDatabase format, GDAL can read that fine and that's what I usually use to export data out of personal geodb.
Answering my own question here that I posted here a while back...
Another option that I found online (in addition to the suggestions above) is to use pgdbf (https://github.com/kstrauser/pgdbf) which dumps the SQL script that you can then use to ingest into postgres manually.