I've just been testing osm2po and everything worked fine and straightforward until it comes to the QGIS pgRoutingLayer Extension. Selecting the Database and selecting source and target node works fine as can be seen in the screenshot below:

enter image description here

but running the process gives me the following error:


enter image description here

EXPORT rsp.:

Layer ist ungültig: Der Layer dbname='routing' host=localhost port=5432 user='postgres' password='admin' key='result_seq'
table="(SELECT mfr_2po_4pgr.*, result.seq AS result_seq, result.node 
AS result_node, result.cost AS result_cost FROM mfr_2po_4pgr
JOIN (SELECT seq, id1 AS node, id2 AS edge, cost
FROM pgr_dijkstra(' SELECT id AS id, osm_source_id::int4
AS source, osm_target_id::int4 AS target, cost::float8 AS cost, reverse_cost::float8 AS reverse_cost
FROM mfr_2po_4pgr', 17642444, 10372788, false, true))
AS result ON mfr_2po_4pgr.id = result.edge)" (geom_way) sql=
ist ungültig und kann der Karte nicht hinzugefügt werden

Software config:

osm2po 5.1.0

postgresql 9.4.(6)

postgis 2.2.1

pgrouting 2.1.0

qgis 2.14.0

pgroutinglayer extension 2.0.0

What went wrong here?

1 Answer 1


Unfortunately pgRoutingLayer wasn't upgraded to use the new pgRouting 2.1 functions that support bigint so it's still falling back on 2.0 which doesn't support bigint.

Looking at the os2po data I load, it looks like it has a source and target fields that are int4. Try using those instead of the bigint osm_source_id, osm_target_id.

The query you have above though looks like it should work with old functions since it's casting to int4. Is that coming from QGIS or what you think it should be writing.

  • Ah I see why it doesn't work -- even though it casts the query fields, it doesn't cast the numbers and you have huge numbers so they come as bigint. Anyway as I said use the source/target provided by os2po instead of the osm_source_id and osm_target_id.
    – Regina Obe
    Commented Mar 21, 2016 at 15:59
  • outch... should have had a decent look at the data before... with source and target everything works fine. The query in the error message was from qgis (the redlined error hint above the map canvas) Commented Mar 21, 2016 at 16:17

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.