Successfully reported this slideshow.
Your SlideShare is downloading. ×

Pgrouting_foss4guk_ross_mcdonald

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad

Check these out next

1 of 31 Ad
Advertisement

More Related Content

Slideshows for you (20)

Similar to Pgrouting_foss4guk_ross_mcdonald (20)

Advertisement

More from Ross McDonald (20)

Recently uploaded (20)

Advertisement

Pgrouting_foss4guk_ross_mcdonald

  1. 1. Using Ordnance Survey datasets with pgRouting Ross McDonald Angus Council @mixedbredie
  2. 2. “The person attempting to travel two roads at once will get nowhere.” - Xun Zi Contains OS Open Data Crown Copyright and Database Right 2016.
  3. 3. What is it? An extension to the PostGIS enabled PostgreSQL database to add geospatial routing functionality.
  4. 4. Why use it? • Free (as in freedom) • Flexible (as in open source) • Functional (as in fully featured) • Fun (if you’re that way inclined)
  5. 5. http://www.cartographicperspectives.org/index.php/journal/rt/printerFriendly/c What does it need?
  6. 6. CC-BY-NC-SAReproducedwiththepermissionoftheNationalLibraryofScotland Where can one get such things?
  7. 7. Data, data everywhere • OS Open Roads • OS Meridian2 • OS Strategi • OS ITN • OS Highways • OS Water Network
  8. 8. OpenStreetMap Metro extracts by Mapzen
  9. 9. "name1" IN ('Watling Street','Fosse Way', 'Ackling Dyke', 'Akeman Street', 'Cade''s Road', 'Dere Street', 'Ermin Way', 'Devil''s Causeway', 'Devil''s Highway', 'Ermine Street', 'Fen Causeway', 'Icknield Street', 'King Street', 'Maiden Way', 'Military Way', 'Peddars Way‘, …) https://dhs.stanford.edu /spatial- humanities/geographic- networks-pgrouting/ /en.wikipedia.org/wiki/Roman_roads_in_Britain#/media/File:Roman_Roads_in_Britannia.svg
  10. 10. But first you gotta be loaded • For OS data – Astun Loader! – Lutra’s OS Translator II – Ogr2ogr – Snowflake’s GoLoader* – Safe’s FME* • For OpenStreetMap – osm2pgrouting
  11. 11. There’s a plugin for that • How can I use it without writing SQL? • pgRouting Layer by Anita Graser and others in the pgRouting team
  12. 12. CC-BY-NC-SAReproducedwiththepermissionoftheNationalLibraryofScotland “Most roads lead men homewards, my road leads forth.” John Masefield
  13. 13. PostgreSQL function to loop through each input point and calculate Djikstra shortest path to every node on the network… pgRouting 1.0.7-dev
  14. 14. pgRouting 2.2.3 • Using pgr_drivingdistance and pgr_alphashape • Using an all-in-one function to process multiple input points IMPROVED
  15. 15. Performance Enhancements • Index your data • Add a Bounding Box to your query • Make it easier for the user
  16. 16. Vanilla Shortest Path SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_dijkstra(' SELECT gid AS id, source::integer, target::integer, cost_time::double precision AS cost, rcost_time::double precision AS reverse_cost FROM or_network', 100828, 1136587, false, true);
  17. 17. M&S Shortest Path SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_dijkstra(' SELECT gid AS id, source::integer, target::integer, cost_time::double precision AS cost, rcost_time::double precision AS reverse_cost FROM or_network WHERE geometry && ST_Expand( (SELECT ST_Collect(the_geom) FROM or_network_vertices_pgr WHERE id IN (100828, 1136587)),5000)', 100828, 1136587, false, true);
  18. 18. Making things even better! • Update the QGIS plugin to use new PGR functions • Update the plugin to use a bounding box • Add restrictions (e.g. closures, safe routes) • How does psycopg2 work? Is it a bottleneck?
  19. 19. Not Mrs Beeton’s recipes http://anitagraser.com https://georepublic.info/en/blog http://workshop.pgrouting.org/index.html http://ghost.mixedbredie.net/tag/pgrouting
  20. 20. CC-BY-NC-SAReproducedwiththepermissionoftheNationalLibraryofScotland Thank you Ross McDonald Angus Council mcdonaldr@angus.gov.uk @mixedbredie 01307476419

×