index pgrouting on postgresql introduction installation template creation and use topological...
TRANSCRIPT
![Page 1: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/1.jpg)
Index
•pgRouting on PostgreSQL•Introduction•Installation•Template Creation and Use• Topological Structure•Core Features•Public Transit Implementation
(Application Specific)
![Page 2: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/2.jpg)
Why routing on PostgreSQL?• PostGIS ships with a Shape file loader an dumper
• Various file types (Shape, MapInfo, DGN, GML, ...) can be read, converted and inserted to a PostGIS database using the OGC libraries
• A PostGIS Feature Table can be used as data source for a growing variety of map and feature server software like UMN MapServer, GeoServer, uDGI, deegree , JUMP, etc...
• The data can be accessed using standard ODBC or JDBC connectors
• Several projects have evolved around PostGIS transforming and inserting geometries from highly specialized formats like SICAD C60, EDBS, DXF, WLDGE and many more
![Page 3: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/3.jpg)
pgRouting :an PostgreSQL Extension• pgRouting adds routing functionality to PostgreSQL.
• pgRouting is an extendible open-source library that provides a variety of tools for shortest path search as extension of PostgreSQL.
• Navigation for road networks requires complex routing algorithms that support turn restrictions and even time dependent attributes.
• Routing basically requires Network topology, which contains edges and nodes.
![Page 4: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/4.jpg)
Core Features of pgRoutingpgRouting provides functions for:
- Shortest Path Dijkstra: routing algorithm without heuristics
- Shortest Path A-Star: routing for large datasets (with heuristics)
- Shortest Path Shooting-Star: routing with turn restrictions (with heuristics)
(Extras)- Traveling Salesperson Problem (TSP)- Driving Distance calculation (Isolines)
![Page 5: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/5.jpg)
pgRouting Installation• On Ubuntu :
# Add pgRouting launchpad repository
sudo add-apt-repository ppa:georepublic/pgrouting
sudo apt-get update
# Install pgRouting packages
sudo apt-get install gaul-devel \postgresql-8.4-pgrouting \postgresql-8.4-pgrouting-dd \postgresql-8.4-pgrouting-tsp
• On Windows:
Download pgRouting binary package from :
http://www.pgrouting.org/download.html
Copy Share folder from binary package to :
C:/Program Files/ … /<version>/lib/
![Page 6: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/6.jpg)
Required Topological data structure• Nodes : points with a geographic position.
• edges : represents connectivity of nodes, representing a polyline or multipolyline.
• Relations : between groups of nodes, edges and other relations which can be assigned certain properties.
• Tags can be applied to nodes, edges or relations and consist of name=value pairs.
![Page 7: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/7.jpg)
pgRouting Template Creation and Use: To enable pgRouting functionality in a database, we
need to run :
pgRouting functions - routing_core.sql- routing_core_wrappers.sql- routing_topology.sql
TSP functions - routing_tsp.sql - routing_tsp_wrappers.sql
Driving Distance functions - routing_dd_wrappers.sql
![Page 8: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/8.jpg)
pgRouting: Topology Calculation
• First we have to add source and target column, then we run the assign_vertex_id function ...:
-- Add "source" and "target" columnALTER TABLE ways ADD COLUMN "source" integer;ALTER TABLE ways ADD COLUMN "target" integer;
-- Run topology function (eg.)
assign_vertex_id(’<table>’, float tolerance, ’<geometry column’, ’<gid>’)
SELECT assign_vertex_id(’ways’, 0.00001, ’the_geom’, ’gid’);
![Page 9: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/9.jpg)
Public Transit Implementation using pgRouting
•Data in-Use:▫POI tables
Bus Stops Malls and Cinema Halls Hospitals .. etc
▫Road Network▫Bus Routes
![Page 10: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/10.jpg)
Without Change-Over from Source to Destination Route Finding
![Page 11: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/11.jpg)
![Page 12: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/12.jpg)
![Page 13: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/13.jpg)
References:• Setting up pgRouting http://www.gpsfiledepot.com/tutorials/installing-and-setting-
up-postgresql-with-postgis/ 1/2
• pgRouting Workshop http://workshop.pgrouting.org/index.html
• pgRouting Documents http://www.pgrouting.org/docs/
• PostGIS in Action
![Page 14: Index pgRouting on PostgreSQL Introduction Installation Template Creation and Use Topological Structure Core Features Public Transit Implementation (Application](https://reader036.vdocuments.net/reader036/viewer/2022062519/5697bfa51a28abf838c97aa8/html5/thumbnails/14.jpg)