2

I'm trying to import a multipolygon layer from "colorado-latest.osm.pbf" into PostGIS. GDAL 2.4.2 has been installed in a Ubuntu system. However, whenever I'm trying to import the osm.pbf file, I get this error:

ogr2ogr -where "building LIKE'%'" -f "PostgreSQL" PG:"host=XXXXXX.us-west-2.rds.amazonaws.com port=5432 user='postgres' password='XXXXXX' dbname='postgres'" colorado_latest.osm.pbf multipolygons

FAILURE:
Unable to open datasource `colorado_latest.osm.pbf' with the following drivers.
  -> PCIDSK
  -> netCDF
  -> JP2OpenJPEG
  -> PDF
  -> MBTiles
  -> EEDA
  -> ESRI Shapefile
  -> Map.....
.........

The ogrinfo query also yield the same error:

ogrinfo -ro -geom=NO -sql "select * from multipolygons where osm_id = '253750'" colorado_latest.osm.pbf

FAILURE:
Unable to open datasource `colorado_latest.osm.pbf' with the following drivers.
  -> PCIDSK
  -> netCDF
  -> JP2OpenJPEG
  -> PDF
  -> MBTiles
  -> EEDA
  -> ESRI Shapefile
  -> Map.....
.........

I'm using GDAL 2.4.2 which supports osm.pbf. I have SQLite installed. ogrinfo --formats also gives a list of formats which contains OSM. I have checked the /usr/share/gdal/osmconf.ini file. Its the same as default. The PostGIS extensions are available in the database and previously I have imported shapefiles into the same.

What do I need to correct here?

2
  • If you have downloaded data from geofabrik.de I suggest to have a cup of coffee, check the spelling, and have a try with colorado-latest.osm.pbf
    – user30184
    Apr 22, 2020 at 6:03
  • @user30184 Thanks indeed ! That was something ! In addition compiling from source code helped following developernote.com/2016/10/… with sqlite3 Apr 22, 2020 at 20:56

1 Answer 1

0

Try to rename the original file name as follows (and update the code):

colorado_latest.osm.pbf -> colorado_latest.pbf

(thus removing the '.osm')

also, as suggested in the comments, check that underscore, usually data downloaded from geofabrik are like 'colorado-latest.osm.pbf'

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.