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.


  • 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?

3 Answers 3


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.

  • Ok, I get it. But why then will I be getting wrong routings, when you specify one source and one target, and the response is completely differente?
    – Laggel
    Commented Sep 3, 2012 at 13:02
  • The response is different? In what way? Have you checked the directed paramater in the meantime?
    – Carsten
    Commented Sep 4, 2012 at 8:17
  • I've just converted and tested the data. Everything is fine. I assume your problem is of different nature.
    – Carsten
    Commented Sep 4, 2012 at 14:39
  • Thank you so much for your help! I have just discovered the embaracing problem!
    – Laggel
    Commented Sep 4, 2012 at 23:42

The problem was referencing wrong the corners. I was using QGIS to determine the source and target ID, what I did was click the segment from when I wanted to go, with the "Identify Spatial Objects" option, and copy the value from the field ID which IS WRONG.

After triple-checking I see that the right value to pick, after clicking "Identify Spatial Objects" is the one in the SOURCE Field of the street segment properties if you want to specify where does the route starts. And the TARGET Field of the street segment properties if you want to specify the ending poing of the route



If you're missing "source" and "target" information it won't work and you will get either errors as you wrote or wrong results.

In your case the network topology is wrong. Maybe you modified something accidentally when you modified the OSM data.

You can do simple checks like these for example:

  • run osm2po on the original OSM data and then try routing
  • load the network data in QGIS for example and check if your network looks OK

Probably your original data is not correct or not in the right format that osm2po expects (ie. wrong projection).

  • Thanks for your answer I loaded in QGIS and it does look ok! But as you say I will try running osm2po with original OSM Data!
    – Laggel
    Commented Sep 3, 2012 at 0:08
  • I loaded the original OSM, I dowanloaded using JOSM because I just need a singly city, but I had the same problem about missing sources, and then I used the PBF of the whole country from download.geofabrik.de but I also had the same problem... any ideas?
    – Laggel
    Commented Sep 3, 2012 at 4:14
  • Well, if you tell us the city or give the download link, someone might try.
    – dkastl
    Commented Sep 3, 2012 at 13:22
  • This is the Island link
    – Laggel
    Commented Sep 3, 2012 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.