[GIS] Importing .gdb database into PostGIS

file-geodatabaseogr2ogr

I'm trying to import a file database into PostGIS. Running ogrinfo on my database I get:

..$ ogrinfo BRP_Gewaspercelen_2009.gdb 

Had to open data source read-only.
INFO: Open of `BRP_Gewaspercelen_2009.gdb'
      using driver `OpenFileGDB' successful.
1: BRP_gewaspercelen_2009_definitief (Multi Polygon)

So I guess I have the required driver to load the file. But ogr2ogr throws me this error:

 ..$ ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5433 dbname=crops
 user=postgres" BRP_Gewaspercelen_2009.gdb 
-overwrite -progress --config PG_USE_COPY YES

FAILURE:
Unable to open datasource `BRP_Gewaspercelen_2009.gdb' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> REC
  -> Memory
  -> BNA
  -> CSV
  -> GML
  -> GPX
  -> KML
  -> GeoJSON
  -> GMT
  -> GPKG
  -> SQLite
  -> WAsP
  -> PCIDSK
  -> OpenFileGDB
  -> XPlane
  -> AVCBin
  -> AVCE00
  -> DXF
  -> Geoconcept
  -> GeoRSS
  -> GPSTrackMaker
  -> VFK
  -> PGDump
  -> OSM
  -> GPSBabel
  -> SUA
  -> OpenAir
  -> PDS
  -> WFS
  -> HTF
  -> AeronavFAA
  -> EDIGEO
  -> GFT
  -> SVG
  -> CouchDB
  -> Idrisi
  -> ARCGEN
  -> SEGUKOOA
  -> SEGY
  -> XLS
  -> ODS
  -> XLSX
  -> ElasticSearch
  -> PDF
  -> CartoDB
  -> SXF

What am I missing?

Best Answer

It doesn't seem like the version of gdal that you have supports .gdb files. Judging by the:

Unable to open datasource `BRP_Gewaspercelen_2009.gdb' with the following drivers.

it seems like it was able to read the right file but just doesn't support. Try this?

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update 
apt-get install gdal-bin libgdal20 libgeos-c1v5 postgresql-9.3-postgis-2.2 postgis

then to check the version run:

ogr2ogr --version

It should output something like

GDAL 2.1.0, released 2016/04/25

On a side note you probably need to upgrade your postgis to 2.2.

Related Question