[GIS] Why is pgRouting shortest route function complaining about wrong source and target IDs

osm2popgrouting

This question is somewhat linked to underdark post, but I think here it would more helpful:
https://underdark.wordpress.com/2011/12/18/osm2po-part-2-pgrouting-on-osm-the-easy-way/#comment-2636

I installed everything to enable the pgrouting, after that I did the extraction from an OSM (modified by me in JOSM) file, to PostgreSQL using Osm2Po but after trying to route it through QuantumGis and the Routing Plugin I had the following issue:

“No se puede ejecutar la consulta.
El mensanje de error de la base de datos fue:
ERROR: Start vertex was not found.

Thing is that after I checked I notice that in my “spatial” table I have:

  • 7,347 Nodes which are never sources
  • 6,966 Nodes which are never targets
  • 6,369 Rows which are never sources nor targets (including above)
    (Note: I have 19,191 nodes)

So I would like to know if you know any reasons why this could had happened or how I couId fix it.

Aside of that I tried routing using existing targets and sources ids, but then I got routes which were not from nor to the nodes I had used… which like dont know why could had happened, but I guess is linked to wrong OSM to PostgreSql Translation.

Finally I tried routing with Osm2Po in the Localhost site and it do worked, so I dont know if the data is ok but some configuration is wrong.

EDIT:

  • Problem is NOT the missing sources or targets node ( @Carsten ).
  • Problem is using wrongs Source Id and Target Id, using the the Street Segments Id instead of the Vertex Id (I could see that double-checking the web routing process of Osm2Po)

BUT the question still remains: How can I find the right source and targets, what Osm2Po called findClosestVertexId?

Best Answer

One possible reason: Imagine a one way ending outside your area. The result is a source node, which is connected to your network and an orphaned target node, that cannot act as source anymore. But this is not an osm2po issue.

I assume it has sth. to with pgRoutings "directed"-parameter.