I am new of pgrouting.

I have created a new network using osm2po with both edges and nodes. Everything works fine, and I have tested the system using the Pgrouting Layer plugin for QGIS but I have noted that I am not able to use a table of POI that are not intersecting my network. POI, edges and nodes

I am not able to figure out how to add these POI as nodes, is there any easy way to solve this? I have already checked the workshop manuals and other discussions, but it seems to me that they don't explain how to do this operation, or, better, I understand that the POI should be on the edge in oder to split the lines before to create the table with the nodes, but if I have a table with hundreds of POI (e.g. all the bar/pubs in a city), and all these points are not in the edge, is there a way to fix it automatically?

Using QGIS 2.99 I see that there are some interesting tools for network analysis, if I try the shortest path algoritm using my table of POI I have this resultenter image description here

I would like to reach the same result using Pgrouting.

Is it possible?

2 Answers 2


You could use the ST_Closespoint function in PostGIS on your POIs before generating the network.

Here is a similar question: How to connect points (bus stops), which don't lie on the lines (LINESTRING), to a network?

  • 1
    Thanks Ylka,I have created a new "POI" table using ST_Closepoint and it works. Now, following your instructions, I should to split the lines with the new POIs and than I just simply to re-run the command for the topology. I'm going to try it immediatly. Thanks a lot Commented Aug 18, 2017 at 13:21

You could use one of the withPoints function to start routing from a POI. The withPoints functions are not officially released yet, but they will be in the next release probably.

See this summary page about the concept with some network diagrams: http://docs.pgrouting.org/2.4/en/withPoints-family.html#withpoints

The with points family of function give you the ability to route between arbitrary points located outside the original graph.

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.