ross mcdonald - pgrouting in qgis
TRANSCRIPT
![Page 1: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/1.jpg)
PGROUTING IN QGIS
How to tame your network - Ross McDonald @mixedbredie
![Page 2: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/2.jpg)
Here be dragons
Get
Merge
Load
Update
Populate
Build
Analyse
Get lost
http://ghost.mixedbredie.net/pgrouting-with-strategi/
![Page 3: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/3.jpg)
Get the data
Open Data Download
http://bit.ly/1I0Fwz3
![Page 4: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/4.jpg)
Merge the roads
There’s a QGIS tool for that!
Select: Motorways, A roads, B roads, primary routes, minor roads and local streets
Vector > Data Management Tools > Merge Shapefiles to One…
![Page 5: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/5.jpg)
Load into PostGIS
QGIS DB
Manager
Schema
Table
Primary key
Geometry
SRID
Spatial index
![Page 6: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/6.jpg)
Update the network table
Add the required columns for pgRouting
Build the indices to make it fast
ALTER TABLE os_strategi.strat_rds
ADD COLUMN source integer,
ADD COLUMN target integer, etc., etc.
CREATE INDEX strat_rds_source_idx ON os_strategi.strat_rds USING btree(source);
![Page 7: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/7.jpg)
Populate the network table
Start and end coordinates
Length costs
Speed (average driving / walking speeds)
Time = length / speed
Reverse costs
![Page 8: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/8.jpg)
Build the network topology
Creates a node table used for start and end
points
SELECT pgr_createtopology(
'os_strategi.strat_rds', 0.001, 'geometry',
'gid', 'source', 'target');
![Page 9: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/9.jpg)
Analyse the network
Checks for errors
MULTILINESTRING v LINESTRING
SELECT pgr_analyzegraph(
'os_strategi.strat_rds', 0.001, 'geometry',
'gid', 'source', 'target');
![Page 10: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/10.jpg)
Get Lost© Crown copyright and database right 2015 100023404
![Page 11: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/11.jpg)
Djikstra Shortest Path
© Crown copyright and database right 2015 100023404Strategi Network
![Page 12: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/12.jpg)
Driving Distance (10min)
© Crown copyright and database right 2015 100023404Strategi Network
![Page 13: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/13.jpg)
Alpha Shapes (isochrones)
© Crown copyright and database right 2015 100023404Strategi Network
![Page 14: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/14.jpg)
Astar heuristic shortest path
Meridian2 Network© Crown copyright and database right 2015 100023404
![Page 15: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/15.jpg)
Turn Restricted Shortest Path
Integrated Transport Network with RRI© Crown copyright and database right 2015 100023404
![Page 16: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/16.jpg)
Geoserver WMS + TRSP
http://ghost.mixedbredie.net/combining-pgrouting-functions-in-openlayers3/
![Page 17: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/17.jpg)
ITN+RRI=TRSP
'select to_cost, teid as
target_id,
feid||coalesce('',''||via,'''') as
via_path from
itn_turn_restrictions‘
Directed = true
Has reverse = true
![Page 18: Ross McDonald - PgRouting in QGIS](https://reader035.vdocument.in/reader035/viewer/2022081721/55abdaeb1a28ab69678b48a7/html5/thumbnails/18.jpg)
Guides
http://anitagraser.com/?s=pgrouting
http://ghost.mixedbredie.net/pgrouting-with-
strategi/
http://ghost.mixedbredie.net/using-
pgrouting-with-os-meridian2/
http://ghost.mixedbredie.net/building-itn-for-
pgrouting/