Have you tried the pgRouting workshop? http://workshop.pgrouting.org/
Daniel On Tue, Aug 16, 2011 at 10:05 AM, Stephen Woodbridge < [email protected]> wrote: > On 8/15/2011 7:02 PM, Robert Sanson wrote: > >> What happens when your click point for a start or end is not directly on >> a node? Does pgrouting snap the start/end points to the nearest vertex >> on the nearest road? >> > > I take the start and end points and in PHP connect to the database and snap > it to the nearest edge like this: > > $sql = "SELECT gid, source, target, the_geom, > distance(the_geom, setsrid(makepoint(". > $lonlat[0].",".$lonlat[1]."), 4326)) AS dist > FROM ".TABLE." > WHERE the_geom && expand(setsrid(makepoint(". > $lonlat[0].",".$lonlat[1]."),**4326), ".$EXPAND.") > ORDER BY dist LIMIT 1"; > > You can write some simple functions in plpgsql like: > > find_nearest_link_within_**distance() > find_nearest_node_within_**distance() > find_node_by_nearest_link_**within_distance() > > 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. > > -Steve > > Thanks, >> Robert >> >> >>> Stephen Woodbridge <[email protected]> 16/08/2011 6:43 a.m. >> >>> >> On 8/15/2011 1:57 PM, sushma wrote: >> > Hi Guys, >> > >> > I want to implement pgrouting using openlayers .i.e to find shortest >> path >> > from building to another buildings.So if user clicks one building as >> a start >> > point and another as end point then it returns the shortest path >> between >> > those buildings. I am totally new to the openlayers. >> > So far i can display the map of road data and buildings from >> geoserver using >> > openlayers. Now i wanted to get on with click control. So need some >> > suggestion how can i get on with click control. >> >> >> Here is an example that I put together using mapserver for the maps, >> pgRouting and I use a small PHP program to handle the the Ajax requests >> to communicate between OpenLayers and pgRouting. >> >> http://tinyurl.com/3vnufmh >> >> -Steve >> ______________________________**_________________ >> Users mailing list >> [email protected] >> http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users> >> >> >> This email and any attachments are confidential and intended solely for >> the addressee(s). If you are not the intended recipient, please notify >> us immediately and then delete this email from your system. >> >> This message has been scanned for Malware and Viruses by Websense Hosted >> Security. www.websense.com <http://www.websense.com/> >> >> > ______________________________**_________________ > Users mailing list > [email protected] > http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users> > -- Georepublic UG & Georepublic Japan eMail: [email protected] Web: http://georepublic.de
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
