3

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?

8
  • You have space character in the file name and ogr2ogr believes that the name ends at that point. Double quotes around name might help. Otherwise I would rename and try again.
    – user30184
    Jan 28, 2017 at 18:55
  • Thanks @user30184 but that doesn't seem to be the issue
    – Md Oliya
    Jan 28, 2017 at 21:19
  • Is the error different now? Message "Unable to open datasource `brpgewaspercelen' " means that ogr2ogr was searching for that shortened name.
    – user30184
    Jan 28, 2017 at 22:09
  • @user30184 i went one level deep into the directory "brpgewaspercelen 2009" and referenced "BRP_Gewaspercelen_2009.gdb" direcrtly. and i got the same messae that it "Unable to open datasource ...". Btw, I'm trying the solution in gis.stackexchange.com/questions/43652/… and at least i don't get an error right away (i'm not sure if it's working yet ..). but strange that OpenFileGDB is there and it can even see file contents with ogrinfo -al but ogr2ogr doesn't ..
    – Md Oliya
    Jan 28, 2017 at 22:14
  • 1
    You should not ever load data as superuser. Best practice calls for independent, minimally privileged logins for data management. Please edit the question to specfy the versions of all software in use.
    – Vince
    Aug 17, 2017 at 11:29

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.