0

I downloaded latest data from Geofabrik and ran the data through osm2po. osm2po web service works fine. I tried to find the route from node 103843 to 170597 and got the following route:

enter image description here

However, using pgr_dijkstra() with data in sql file produced by osm2po, I got a totally different route with different start and end point.

To check whether my query is the problem, I used pgrouting layer in QGIS and got the same result.

Interestingly, I found that the route is not correct, as it doesn't always go along the road network.

enter image description here

How can I make pgrouting produces the same result as osm2po web service?

1

osm2po writes the same IDs for nodes and segments as for its own routing. So, as long as you do not enable special things like "ignore oneways" e.g. and call anything else than pgrouting's Dijkstra, the result must be the same. Which Ids do you use for source and target? Do not use osm_source_id or osm_target_id. Furthermore, be aware, that osm2po produces an undirected graph-table. Yes, pgrouting provides a parameter for this case!

And no, osm2po does not uses pbf-files directly. Instead they have to be converted over many steps in order to make them routable at all.

  • Thanks for your answer. I used default config as provided in version 5.1.0 to get the sql file to import to pgrouting. I used ids in source and target columns. The same id always refer to different nodes in osm2poservice and pgrouting. – Du Kuch Apr 2 '16 at 11:08
0

I think the osm2po service works against the raw osm file or pbf file and builds a graph in memory, so could be a difference in how it is processing the data in its graph and what it finally feeds into postgres (assuming you are comparing the same algorithm).

I think osm2po for example does do some processing and splitting before feeding to postgres. You might want to check the node numbers you see that should be there and verify those nodes are apparent in the osm2po service. If they are not present, could be a bug in how osm2po is converting the data to postgres. I should add when osm2po processes data, it produces two sets of source and target

a small in source and target. A big in osm_source_id and osm_target_id. Not sure which ones it uses in the service. I think source and target it creates specifically for pgRouting so may be using the other. In which case, try to use the other for your query too.

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.