Hi Devs,<br><br>I built the following web application using pg_routing.<br><a href="http://ncg.nuim.ie/i2maps/projects/sp/index.html">http://ncg.nuim.ie/i2maps/projects/sp/index.html</a><br><br>This application lets you calculate shortest paths from any two points (<b>not any two nodes, which seems to be the standard</b>) on the OSM network. <div>
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.</div><div>I wrote this function because I need to take n GPS points and return a single path which visits each point in turn.</div>
<div><br></div><div>Currently this is half written in Python using the Django Geos API and it works perfectly.</div><div>I would however like to convert this into a pgRouting wrapper function but I am struggling to convert my Python into plpgsql.</div>
<div><br></div><div>Can you help?</div><div>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. </div><div>What I want to do is the below but this is not valid plpgsql, can you teach me how to write this correctly?</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div><div>DECLARE</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>sp record[];</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>record first;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>record last;</div><div>BEGIN</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>sp := dijkstra_sp_directed('ways', 100, 1000, true, true);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>first := sp[0]</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>last := sp[-1]</div><div>END;</div></div><div><br></div><div>Kind regards,</div>
<div>Cathal</div><div><br></div>