I've downloaded an extent of OSM data with QGIS's OpenStreetMap downloader, and want to use this data for with pgRouting. I can load it without problems as:

osm2pgrouting --f data.osm --conf mapconfig.xml --dbname db --username user --schema osm --clean

However, as you can see in the picture, the many of the dead-ends get connected to some seemingly random vertices. These dead-ends were created by cutting the OSM data with the extent polygon.

I'm using osm2pgrouting 2.3.2

Any tips on how to import OSM data cleanly?

enter image description here

  • Which version of osm2pgrouting are you using? – LR1234567 Nov 10 '17 at 8:41
  • I'm using 2.3.2 – Balazs Dukai Nov 10 '17 at 9:01


I've never used QGIS before for downloading OSM data so not sure if it does anything special. Also I'm not sure what area you are downloading to be able to replicate.

Can you try using overpass api instead to download your area of interest and then use the osm file in osm2pgrouting. This is documented in worksop http://workshop.pgrouting.org/2.4.11/en/chapters/prepare_data.html#option-3-download-using-overpass-xapi

so your command would look something like below which you call from commandline:

wget --progress=dot:mega -O sample.osm "http://www.overpass-api.de/api/xapi?*[bbox=-71.16528,42.31628,-70.99396,42.39493][@meta]"

If you still have issue, post the overpass command you are using.

  • BTW: XAPI is seriously outdated these days, the workshop material really needs an overhaul. See wiki.openstreetmap.org/wiki/Xapi – mmd Nov 14 '17 at 15:34
  • The workshop material is to be used with OSGeoLive Disk on a virtual machine, it has the xapi example for people that don't have the VM and have all the software that OSGeoLive provides installed in their own computer but lacks the data. – Vicky Nov 14 '17 at 21:58
  • Downloading additional data is not the issue, but using XAPI is (at least in the long run). Better go to openstreetmap.org, hit the "Export" button, select your area, and click on the "Overpass API" download link. That download link (e.g. overpass-api.de/api/map?bbox=7.43934,51.06231,7.46305,51.07082) should be included in the workshop material instead of the XAPI link. – mmd Nov 15 '17 at 12:26

I do have exactly the same issues as described by Balazs with the following setup:

  • PostgreSQL 10.3
  • PostGIS 2.4.4.
  • pgrouting 2.6.0
  • osm2pgrouting 2.3.3
  • Ubuntu 18.04

And following mapconfig.xml file:


The data is originating from an osm.pbf-file and was downloaded from Geodatenfabrik. Are there any recommendations? If possible I want to use the listed versions of the software.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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