Shortest Path Search   with pgRouting                  Daniel Kastl
What is pgRouting?
An Extension forPostgreSQL / PostGIS, ...
An Open Source    project, ...
A Library providing, ...
Shortest Path
DD and TSP
DARP
@justjkk@jay_mahadeokar
APSP and TDSP
Multi-Modal
https://github.com/pgRouting/pgrouting
SQL FunctionSELECT * FROM shortest_path(      SELECT gid as id,             source::integer,             target::integer, ...
Query Result vertex_id | edge_id |         cost-----------+---------+--------------------       605 |     599 |    0.19925...
Most users need pgRouting for    Road Networks    How do they look like?
Like this ...
… or like this ...
… or sometimes like this.
What makes them real?Traffic lights   Signs   Road marking
How can pgRouting help here?
gid,                  source,source            target,                  cost,                  reverse_cost,              ...
Traffic lights slow down  … so costs must increase.
B                      C        1minA                  D               cost(A)=cost(A)+30sec               cost(B)=cost(B)...
Signs inform aboutrestrictions and rules
cost(A) = length(A)    reverse_cost(A) = ∞A
Sometimes  the costshave different  meaning.
cost(A)=length(A)/2        reverse_cost(A)=length(A)*2            cost(B)=length(B)*3        reverse_cost(B)=length(B)/3  ...
Turn restrictions   obviously restrict turns.
B                      C        1minA                  D               cost(A)=cost(A)+1min               cost(B)=cost(B)+...
Road typecan be used for costcalculation.
Not only road typesbut also conditions
Jughandle intersectionhttp://upload.wikimedia.org/wikipedia/commons/e/e4/Jughandle_signage.jpg
@ckrahe
And you knowwhat is great about pgRouting?
All costs are dynamic!… which is the opposite to pre-calculated
If the road is closed ...
… or there is an accident, ...
… there is a sign with restrictions limited to a certain time, ...
… bad weather conditions ...
… or any other obstacle, ...
You dont need torebuild and reload  your network
… and wait forever.
You only need to adjust the cost     for this particular road,and the next search will go another way.
Cost can be virtually anything
OpenStreetMap data
pgRouting can be used fordifferent kinds of networks
Canals and  Rivers
Hiking trails
… or any otherkind of networks.
pgRouting Demo      http://websi.openvrp.com       http://map.veloland.ch     http://www.ridethecity.comhttp://www.pgrouti...
Plans until FOSS4G 2012●    Integrate new functions    ●        All-Pair-Shortest-Path    ●        Time-Dependent-Shortest...
www.pgrouting.orgworkshop.pgrouting.orgdaniel@georepublic.de
Photos from sxc.hu andflickr under Creative Commons Licence.
Shortest Path Search with pgRouting
Shortest Path Search with pgRouting
Upcoming SlideShare
Loading in …5
×

Shortest Path Search with pgRouting

1,022
-1

Published on

Shortest Path Search with pgRouting by Daniel Kastl of GeoRepublic

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,022
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
21
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Shortest Path Search with pgRouting

  1. 1. Shortest Path Search with pgRouting Daniel Kastl
  2. 2. What is pgRouting?
  3. 3. An Extension forPostgreSQL / PostGIS, ...
  4. 4. An Open Source project, ...
  5. 5. A Library providing, ...
  6. 6. Shortest Path
  7. 7. DD and TSP
  8. 8. DARP
  9. 9. @justjkk@jay_mahadeokar
  10. 10. APSP and TDSP
  11. 11. Multi-Modal
  12. 12. https://github.com/pgRouting/pgrouting
  13. 13. SQL FunctionSELECT * FROM shortest_path( SELECT gid as id, source::integer, target::integer, length::float8 as cost FROM ways, 605, 359, false, false);
  14. 14. Query Result vertex_id | edge_id | cost-----------+---------+-------------------- 605 | 599 | 0.19925085940845 604 | 598 | 0.100258103875674 603 | 597 | 0.201123583387407 602 | 596 | 0.204847680679676 601 | 595 | 0.158334540345002 4293 | 9602 | 0.0183273901669081 ... | ... | ...
  15. 15. Most users need pgRouting for Road Networks How do they look like?
  16. 16. Like this ...
  17. 17. … or like this ...
  18. 18. … or sometimes like this.
  19. 19. What makes them real?Traffic lights Signs Road marking
  20. 20. How can pgRouting help here?
  21. 21. gid, source,source target, cost, reverse_cost, x1, y1, x2, y2, rule, to_cost target
  22. 22. Traffic lights slow down … so costs must increase.
  23. 23. B C 1minA D cost(A)=cost(A)+30sec cost(B)=cost(B)+30sec cost(C)=cost(C)+30sec cost(D)=cost(D)+30sec
  24. 24. Signs inform aboutrestrictions and rules
  25. 25. cost(A) = length(A) reverse_cost(A) = ∞A
  26. 26. Sometimes the costshave different meaning.
  27. 27. cost(A)=length(A)/2 reverse_cost(A)=length(A)*2 cost(B)=length(B)*3 reverse_cost(B)=length(B)/3 BA
  28. 28. Turn restrictions obviously restrict turns.
  29. 29. B C 1minA D cost(A)=cost(A)+1min cost(B)=cost(B)+1min rule(A) = "D" cost(C)=cost(C)+1min cost(D)=cost(D)+1min∞ to_cost(A, D) =
  30. 30. Road typecan be used for costcalculation.
  31. 31. Not only road typesbut also conditions
  32. 32. Jughandle intersectionhttp://upload.wikimedia.org/wikipedia/commons/e/e4/Jughandle_signage.jpg
  33. 33. @ckrahe
  34. 34. And you knowwhat is great about pgRouting?
  35. 35. All costs are dynamic!… which is the opposite to pre-calculated
  36. 36. If the road is closed ...
  37. 37. … or there is an accident, ...
  38. 38. … there is a sign with restrictions limited to a certain time, ...
  39. 39. … bad weather conditions ...
  40. 40. … or any other obstacle, ...
  41. 41. You dont need torebuild and reload your network
  42. 42. … and wait forever.
  43. 43. You only need to adjust the cost for this particular road,and the next search will go another way.
  44. 44. Cost can be virtually anything
  45. 45. OpenStreetMap data
  46. 46. pgRouting can be used fordifferent kinds of networks
  47. 47. Canals and Rivers
  48. 48. Hiking trails
  49. 49. … or any otherkind of networks.
  50. 50. pgRouting Demo http://websi.openvrp.com http://map.veloland.ch http://www.ridethecity.comhttp://www.pgrouting.org/gallery.html
  51. 51. Plans until FOSS4G 2012● Integrate new functions ● All-Pair-Shortest-Path ● Time-Dependent-Shortest-Path ● Multi-Modal ● Two-way A-Star, ...● Drop CGAL dependency● PostgreSQL 9.x & PostGIS 2.0 support● Source cleanup
  52. 52. www.pgrouting.orgworkshop.pgrouting.orgdaniel@georepublic.de
  53. 53. Photos from sxc.hu andflickr under Creative Commons Licence.

×