pgRouting

Forum #15 - Topic #147 - Message List

pgRouting in action: Ride the City.com

Hi pgRouting folks:

You might be interested in seeing a live pgRouting routing application that a couple friends and I just released to the world yesterday. It's a bicycle routing application for New York City based on a 127,000 row street segment table. I'm extremely pleased with the performance (and I think I can even enhance it further with some additional data cleanup).

Anyway, check it out: http://www.ridethecity.com

Thanks for creating pgRouting and making this possible!

Jordan jordandrsn [at-sign] gmail [dot] com

  • Message #506

    Hi, very nice site. I now working creating the driving instructions to follow the route, and i like what i saw on the site. Im wonder if you could help me, im still trying to found the angle when changing streets to put left or right turns. But i see you also said on your instructions things like "Turn right and ride southwest"

    • Message #509

      Hi Juan,

      I actually did the directions processing via PHP. In my select statement where I called the pgRouting shortest path function, I also obtained the startpoint and endpoint of the_geom, the street name, and the type of bicycle facility (none, bike lane, etc.).

      I looped through each step of the results and, every time the street name or bicycle facility differed from the previous step, I calculated the angle between the imaginary line created by the previous geometry's start/end points and the imaginary line created by the next geometry's start/end points.

      Note that this works fine in a perfect grid, but doesn't work when you have streets that curve. In that case, you would really want to get the angle of the last substring of the geometry from the previous step and the first substring of the geometry in the next step. Since most of NYC is grid-like, I'll save that for version 2.0 ;).

      I created a very simple function that determines whether you should "turn hard right" | "turn soft right" | "turn left", etc. based on the angle between the two street segments.

  • Message #507

    Wow, thanks a lot for that nice pgRouting application! I will add a link on the gallery page.

    The driving directions are a nice feature, but unfortunately it depends a lot on the data (ie. we usually don't have street names here in Japan). It would be great to share ideas or problems (if you had some ;-)

  • Message #513

    Hi,

    This is SO cool! Thank you for posting it here!

  • Message #515

    Here are some more hints for aspiring pgRouting users.

    1. Download and use the tutorial. I would say that 80% of the core Ride the City routing functionality is taken directly from that tutorial.

    2. I allow users to choose the 'most direct', 'safe', and 'safest' routes. All of those are based on different costs, of course. To save time in the query process I don't do any of the cost weighting calculations in real time. Instead, I created an SQL query that I can run periodically to update three different sets of cost fields (and the reverse of those cost fields since I have to deal with one-way streets). It takes 20 minutes to do all the updates, but speeds up the response time for users by some small amount.

    3. Using OpenLayers, with a surprisingly small amount of javascript and php (or python or whatever you use on the server-side) you can create your own mini-GIS to update the edges in your routing table. This was really useful for doing data cleanup (manually overriding costs, fixing street directionality, etc). If you look at http://ridethecity.com/feedback.php you can get an idea of what I mean. The php file on the server has just two functions: one to select the edge you click on from PostGIS and one to update that record when you submit your changes.

    Jordan