This application lets you calculate shortest paths from any two points (not any two nodes, which seems to be the standard) on the OSM network.
You add points by left clicking on the map, red points are your clicks, blue points are the closest points on the OSM network to your clicks.
I wrote this function because I need to take n GPS points and return a single path which visits each point in turn.

Currently this is half written in Python using the Django Geos API and it works perfectly.
I would however like to convert this into a pgRouting wrapper function but I am struggling to convert my Python into plpgsql.

Can you help?
I am stuck at one particular part, after I have calculated the shortest path I need to do some tests on the first and last ways.
What I want to do is the below but this is not valid plpgsql, can you teach me how to write this correctly?

DECLARE
sp record;
record first;
record last;
BEGIN
sp := dijkstra_sp_directed(‘ways’, 100, 1000, true, true);
first := sp[0]
last := sp[-1]
END;

This application lets you calculate shortest paths from any two points (not any two nodes, which seems to be the standard) on the OSM network.
You add points by left clicking on the map, red points are your clicks, blue points are the closest points on the OSM network to your clicks.
I wrote this function because I need to take n GPS points and return a single path which visits each point in turn.

Currently this is half written in Python using the Django Geos API and it works perfectly.
I would however like to convert this into a pgRouting wrapper function but I am struggling to convert my Python into plpgsql.

Can you help?
I am stuck at one particular part, after I have calculated the shortest path I need to do some tests on the first and last ways.
What I want to do is the below but this is not valid plpgsql, can you teach me how to write this correctly?

DECLARE
sp record;
record first;
record last;
BEGIN
sp := dijkstra_sp_directed(‘ways’, 100, 1000, true, true);
first := sp[0]
last := sp[-1]
END;

Kind regards,
Cathal

Hi Cathal,

thank you for sharing your nice demo application!

If you look at this demo (zoom in to see path details), you will see that it also starts in the middle of an edge. http://websi.openvrp.com/