I am importing OSM data into PostGIS using osm2pgrouting but some data is missing/did not import. I am using the default mapconfig.xml and this appears to work for most roads.

For example in below screencap, blue is the ways created by osm2pgrouting, and red is the line when the data is imported using osm2pgsql (using default.style and red filtered on "highway" = 'motorway' for this questions purposes). The missing section is a bridge, however other bridges have imported correctly, and some other roads (like 'service') are also missing.

missing lines

The osm id of one of the missing lines in the pic is 158307203 if that helps, data sourced from Mapzen. The XML of that line is:

<way id="158307203" version="11" timestamp="2015-03-28T10:51:02Z" changeset="29802641" uid="1242214" user="jc86035">
        <nd ref="291167188"/>
        <nd ref="2355888876"/>
        <nd ref="1834210085"/>
        <nd ref="291167189"/>
        <nd ref="1274007359"/>
        <nd ref="1274007366"/>
        <nd ref="2355888862"/>
        <nd ref="291167190"/>
        <tag k="lit" v="yes"/>
        <tag k="ref" v="8"/>
        <tag k="foot" v="no"/>
        <tag k="name" v="xxxx Tsing Ma Bridge"/>
        <tag k="lanes" v="3"/>
        <tag k="layer" v="4"/>
        <tag k="bridge" v="yes"/>
        <tag k="oneway" v="yes"/>
        <tag k="bicycle" v="no"/>
        <tag k="highway" v="motorway"/>
        <tag k="name:de" v="Tsing-Ma-Brücke"/>
        <tag k="name:en" v="Tsing Ma Bridge"/>
        <tag k="name:es" v="Puente Tsing Ma"/>
        <tag k="name:fr" v="Pont Tsing Ma"/>
        <tag k="name:sv" v="Tsing Ma-bron"/>
        <tag k="name:zh" v="xxxx"/>
        <tag k="surface" v="asphalt"/>
        <tag k="cycleway" v="no"/>
        <tag k="maxspeed" v="80"/>
        <tag k="wikipedia" v="zh:xxxx"/>
        <tag k="start_date" v="1997-05-22"/>
        <tag k="name:zh-yue" v="xxxx"/>

(Chinese characters replaced with x to post on StackExchange).

Below is the log when I imported the data:

$osm2pgrouting -file ~/osm2pgrouting/mapconfig.xml -dbname gis -user gisuser -passwd gisuser -clean
host= user=gisuser dbname=gis port=5432 password=gisuser
connection success
Trying to load config file /path/to/mapconfig.xml
Trying to parse config
Trying to load data
Trying to parse data
unknown maxspeed value: 56; 72; 72
unknown maxspeed value: 56;108
unknown maxspeed value: 56;108
Split ways
Dropping tables...
Creating tables...
Nodes table created
2create ways failed:
Types table created
Way_tag table created
Relations table created
Relation_ways table created
Classes table created
Adding tag types and classes to database...
Adding relations to database...
Adding nodes to database...
Adding ways to database...
Creating topology...
NOTICE:  pgr_createTopology('ways',1e-05,'the_geom','gid','source','target','tru
NOTICE:  Performing checks, pelase wait .....
NOTICE:  Creating Topology, Please wait...
NOTICE:  1000 edges processed
NOTICE:  282000 edges processed
NOTICE:  -------------> TOPOLOGY CREATED FOR  282284 edges
NOTICE:  Rows with NULL geometry or NULL id: 0
NOTICE:  Vertices table for table osm2pgr.ways is: osm2pgr.ways_vertices_pgr
NOTICE:  ----------------------------------------------
Create Topology success
size of streets: 128763
size of splitted ways : 282284

I noticed the "2create ways failed" message but not sure why no error message was generated. Hoping someone can explain why these roads failed to import.

2 Answers 2


Just a note -- this was posted and closed at https://github.com/pgRouting/osm2pgrouting/issues/114


It appears the OSM data from Mapzen is different from those extracted from OpenStreetMap directly (as of Sept 2015), causing osm2pgrouting to not form some lines.

An alternative to Mapzen metro extracts is to use Overpass API for areas too large for a direct OSM extract.

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.