[GIS] Importing large OSM data to QGis failed (using QuickOSM, SpatialLite layer or add vector layer)

geofabrikopenstreetmapqgisquickosm

I downloaded quite large OpenStreetMap dataset from https://www.geofabrik.de/ in osm (or pbf) format. Namely Czech Republic. Geofabrik provides ESRI SHP files too, but I unfortunatelly need more attributes (are not included in prebuilded shp files).

Question is, how to import OSM to the QGIS?
I know 3 ways, but each of them has issues or doesn't work:

1) Vector->OpenStreetMap->Import Topology from XML…->Export Topology to SpatialLite

This works, but:

  • relations are not imported; some attributes missing (when compared
    with OSM map on the web)

  • polygon holes are not imported correctly (courtyards of houses are
    filled)

2) Add Vector Layer…

Simple, but it imports nothing! After openning .osm or .pbf file (using UTF-8 encoding), QGis shows dialog, where number of elements is ZERO (points, lines, polygons, …)

3) Import OSM File using QuickOSM plugin

Plugin is computing many hours, but at the end, there is no new layer, or sometimes layers named OsmFile, but empty.

I have newest QGis (2.18.12) and newest QuickOSM plugin (sorry, I don't see it's version in gui). My PC is Intel Core i7, 16GB RAM, SSD disc, Windows 10 Pro.

Best Answer

There is no other way for calculating the number of features from the osm.pbf file than to parse all the data from the file. Therefore in your case 2) QGIS saves your time and shows the number of features as zero. That's intentional. Just select the desired layer, add it in to your map, and you will see the data.

enter image description here

QGIS open that large .pbf file rather slow. I would read first what the driver manual page http://www.gdal.org/drv_osm.html says about osmconf.ini and then convert the .pbf file into SpatiaLite database with ogr2ogr. The basic command is

ogr2ogr -f sqlite -dsco spatialite=yes czech-republic.sqlite czech-republic-latest.osm.pbf
Related Question