<br><br><div class="gmail_quote">2011/4/13 cathal coffey <span dir="ltr">&lt;<a href="mailto:coffey.cathal@gmail.com">coffey.cathal@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

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" target="_blank">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>



<div><br></div><div><div>DECLARE</div><div><span style="white-space:pre-wrap">        </span>sp record[];</div><div><span style="white-space:pre-wrap">        </span>record first;</div>

<div><span style="white-space:pre-wrap">        </span>record last;</div><div>BEGIN</div><div><span style="white-space:pre-wrap">        </span>sp := dijkstra_sp_directed(&#39;ways&#39;, 100, 1000, true, true);</div>

<div><span style="white-space:pre-wrap">        </span>first := sp[0]</div><div><span style="white-space:pre-wrap">        </span>last  := sp[-1]</div><div>END;</div></div><div><br></div><div>Kind regards,</div>

<div>Cathal</div></blockquote><div><br></div><div><br></div><div>Hi Cathal,</div><div><br></div><div>thank you for sharing your nice demo application!</div><div><br></div><div>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. </div>

<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://websi.openvrp.com/">http://websi.openvrp.com/</a></div><div><br></div><div>It also adds a line from the to the start/end point to the closest point on the nearest edge.</div>

<div>The wrapper used in this demo is written in plpgsql and the source is here:</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="https://github.com/pgRouting/pgrouting-contrib/blob/master/wrapper/routing_core_smart.sql">https://github.com/pgRouting/pgrouting-contrib/blob/master/wrapper/routing_core_smart.sql</a></div>

<div><br></div><div>Maybe it gives you some hints how to write your own wrapper. It uses Shooting Star though.</div><div><br></div><div>Daniel</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<font color="#888888"><div><br></div>
</font><br>_______________________________________________<br>
pgrouting-dev mailing list<br>
<a href="mailto:pgrouting-dev@lists.osgeo.org">pgrouting-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG &amp; Georepublic Japan<br>eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66, 99, 171)" target="_blank">daniel.kastl@georepublic.de</a><br>

Web: <a href="http://georepublic.de/" style="color:rgb(66, 99, 171)" target="_blank">http://georepublic.de</a></span><br>