Your SlideShare is downloading. ×
Shortest Path search in your Database and more with pgRouting - FOSS4G Europe 2014
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Shortest Path search in your Database and more with pgRouting - FOSS4G Europe 2014

230

Published on

pgRouting extends the PostGIS / PostgreSQL geospatial database to provide shortest path search and other network analysis functionality. …

pgRouting extends the PostGIS / PostgreSQL geospatial database to provide shortest path search and other network analysis functionality.

This presentation will show the inside and current state of the pgRouting development, from its wide range of shortest path search algorithms to driving distance calculation or “Traveling Sales Person” (TSP) optimization. Additionally we will give a brief outlook and introduction of upcoming new features like the “Vehicle Routing Problem” (VRP) solver, and what we have in mind for future releases.

We will explain the shortest path search in real road networks and how the data structure is important to get better routing results. Furthermore we will show how you can improve the quality of the search with dynamic costs and make the result look closer to the reality. You will also learn about difficulties and limitations of the library, and when pgRouting might not be not the right tool to solve your routing problem.

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
230
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Shortest Path Search with pgRouting Daniel Kastl
  • 2. What is pgRouting ?
  • 3. An Extension for PostgreSQL / PostGIS, ...
  • 4. An Open Source project, ...
  • 5. A Library providing, ...
  • 6. Shortest Path
  • 7. Driving Distance
  • 8. Traveling Salesperson
  • 9. v2.0
  • 10. Feature Highlights ➔ Two new All Pairs Short Path algorithms ➔ Bi-directional Dijkstra and A-star algorithms ➔ One to many nodes shortest path search ➔ New TSP solver (with distance matrix) ➔ Turn Restricted shortest path (replaces Shooting Star algorithm) ➔ A collection of useful utility and graph analytics functions
  • 11. More Highlights ➔ Modular library design ➔ Unit tests and automated tests with Travis ➔ Compatibility with PostgreSQL 9.1+ / PostGIS 2.0+ ➔ Installs as PostgreSQL EXTENSION ➔ Added pgr_ prefix to functions and types ➔ Improved build process for Windows ➔ Better documentation in several languages https://www.transifex.com/projects/p/pgrouting/
  • 12. Most users need pgRouting for Road Networks How do they look like?
  • 13. Like this ...
  • 14. … or like this ...
  • 15. … or sometimes like this.
  • 16. What makes them real? Traffic lights Signs Road marking
  • 17. pgRouting extends PostgreSQL/PostGIS CREATE EXTENSION postgis; CREATE EXTENSION pgrouting;
  • 18. SQL Function SELECT * FROM pgr_dijkstra(' SELECT gid as id, source::integer, target::integer, length::float8 as cost FROM ways', 30, 60, false, false);
  • 19. Query Result seq | node | edge | cost -----+------+------+--------------------- 0 | 30 | 53 | 0.0591267653820616 1 | 44 | 52 | 0.0665408320949312 2 | 14 | 15 | 0.0809556879332114 3 | 13 | 14 | 0.072694271986776 4 | 12 | 13 | 0.081239348480584 5 | 11 | 12 | 0.00746935522787469 6 | 10 | 6869 | 0.0164274192597773 7 | 59 | 72 | 0.0109385169537801 8 | 60 | -1 | 0 (9 rows)
  • 20. gid, source, target, cost, reverse_cost, x1, y1, x2, y2, rule, to_cost source target
  • 21. Traffic lights slow down … so costs must increase.
  • 22. 1 min cost(A) = cost(A) + 30sec cost(B) = cost(B) + 30sec cost(C) = cost(C) + 30sec cost(D) = cost(D) + 30sec B C D A
  • 23. cost(A) = length(A) reverse_cost(A) = ∞ A
  • 24. Sometimes the costs have different meaning.
  • 25. A B cost(A) = length(A) / 2 reverse_cost(A) = length(A) * 4
  • 26. Road type can be used for cost calculation.
  • 27. Not only road types but also conditions
  • 28. And you know what is great about pgRouting?
  • 29. All costs are dynamic! … which is the opposite to pre-calculated
  • 30. If the road is closed ...
  • 31. … or there is an accident, ...
  • 32. … there is a sign with restrictions limited to a certain time, ...
  • 33. … bad weather conditions ...
  • 34. You don't need to rebuild and reload your network
  • 35. You only need to adjust the cost for this particular road, … and the next search will go another way.
  • 36. Flexiblity vs. Speed
  • 37. Cost can be virtually anything
  • 38. pgRouting can be used for different kinds of networks
  • 39. Canals and Rivers
  • 40. Hiking trails
  • 41. … or any other kind of networks
  • 42. pgRouting can be enhanced with custom functions
  • 43. SELECT * FROM ctg_drivingdistance( ST_SetSRID( ST_MakePoint(-117.1078764,32.7111995),4326), 'ways', '2500,5000,7500', 'm');
  • 44. Roadmap for Version 2.1 ➔ Add “Multi-modal public transit routing” (GSoC 2011) ➔ Add “Time dependent shortest path” algorithm (GSoC 2011) ➔ Add “Two Queue” Algorithm (GSoC 2012) ➔ Add DARP and VRP (GSoC 2013 and 2014) ➔ Add Graph network partitioning (GSoC 2013) ➔ …. further improvements and bug fixes.
  • 45. Tour Optimization & VRP
  • 46. https://github.com/pgRouting
  • 47. Website: pgrouting.org Documentation: docs.pgrouting.org Workshop: workshop.pgrouting.org Support: pgrouting.org/support.html More Information … or talk contact us directly: ➔ daniel@georepublic.de ➔ Twitter: @dkastl
  • 48. Photos from sxc.hu and flickr under Creative Commons Licence.

×