Have you tried the pgRouting workshop?<div><a href="http://workshop.pgrouting.org/">http://workshop.pgrouting.org/</a></div><div><br></div><div>Daniel</div><div><br><br><div class="gmail_quote">On Tue, Aug 16, 2011 at 10:05 AM, Stephen Woodbridge <span dir="ltr">&lt;<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 8/15/2011 7:02 PM, Robert Sanson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What happens when your click point for a start or end is not directly on<br>
a node? Does pgrouting snap the start/end points to the nearest vertex<br>
on the nearest road?<br>
</blockquote>
<br></div>
I take the start and end points and in PHP connect to the database and snap it to the nearest edge like this:<br>
<br>
    $sql = &quot;SELECT gid, source, target, the_geom,<br>
        distance(the_geom, setsrid(makepoint(&quot;.<br>
                    $lonlat[0].&quot;,&quot;.$lonlat[1].&quot;), 4326)) AS dist<br>
            FROM &quot;.TABLE.&quot;<br>
            WHERE the_geom &amp;&amp; expand(setsrid(makepoint(&quot;.<br>
            $lonlat[0].&quot;,&quot;.$lonlat[1].&quot;),<u></u>4326), &quot;.$EXPAND.&quot;)<br>
            ORDER BY dist LIMIT 1&quot;;<br>
<br>
You can write some simple functions in plpgsql like:<br>
<br>
find_nearest_link_within_<u></u>distance()<br>
find_nearest_node_within_<u></u>distance()<br>
find_node_by_nearest_link_<u></u>within_distance()<br>
<br>
I have these on one database, but I can remember if I wrote these or they are part of pgRouting as I try to encapsulate most code in simple function calls so it is reusable.<br>
<br>
-Steve<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
Thanks,<br>
Robert<br>
<br>
 &gt;&gt;&gt; Stephen Woodbridge &lt;<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>&gt; 16/08/2011 6:43 a.m. &gt;&gt;&gt;<br>
On 8/15/2011 1:57 PM, sushma wrote:<br>
 &gt; Hi Guys,<br>
 &gt;<br>
 &gt; I want to implement pgrouting using openlayers .i.e to find shortest path<br>
 &gt; from building to another buildings.So if user clicks one building as<br>
a start<br>
 &gt; point and another as end point then it returns the shortest path between<br>
 &gt; those buildings. I am totally new to the openlayers.<br>
 &gt; So far i can display the map of road data and buildings from<br>
geoserver using<br>
 &gt; openlayers. Now i wanted to get on with click control. So need some<br>
 &gt; suggestion how can i get on with click control.<br>
<br>
<br>
Here is an example that I put together using mapserver for the maps,<br>
pgRouting and I use a small PHP program to handle the the Ajax requests<br>
to communicate between OpenLayers and pgRouting.<br>
<br>
<a href="http://tinyurl.com/3vnufmh" target="_blank">http://tinyurl.com/3vnufmh</a><br>
<br>
-Steve<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/openlayers-<u></u>users</a><br>
<br>
<br>
This email and any attachments are confidential and intended solely for<br>
the addressee(s). If you are not the intended recipient, please notify<br>
us immediately and then delete this email from your system.<br>
<br>
This message has been scanned for Malware and Viruses by Websense Hosted<br></div></div>
Security. <a href="http://www.websense.com" target="_blank">www.websense.com</a> &lt;<a href="http://www.websense.com/" target="_blank">http://www.websense.com/</a>&gt;<br>
<br>
</blockquote><div><div></div><div class="h5">
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/openlayers-<u></u>users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <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>
</div>