Table of Contents¶
pgRouting extends the PostGIS/PostgreSQL geospatial database to provide geospatial routing and other network analysis functionality.
This is the manual for pgRouting 2.1.0 (b38118a master).
The pgRouting Manual is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Feel free to use this material any way you like, but we ask that you attribute credit to the pgRouting Project and wherever possible, a link back to http://pgrouting.org. For other licenses used in pgRouting see the License page.
General¶
Tutorial¶
- Getting started
- Routing Topology for an overview of a topology for routing algorithms.
- Graph Analytics for an overview of the analysis of a graph.
- Dictionary of columns & Custom Query that is used in the routing algorithms.
- Performance Tips to improve your performance.
- Sample Data that is used in the examples of this manual.
- User’s Recipes List
For a more complete introduction how to build a routing application read the pgRouting Workshop.
Data Types¶
- pgr_costResult[] - A set of records to describe a path result with cost attribute.
- pgr_costResult3[] - A set of records to describe a path result with cost attribute.
- pgr_geomResult - A set of records to describe a path result with geometry attribute.
Topology functions¶
- pgr_createTopology - to create a topology based on the geometry.
- pgr_createVerticesTable - to reconstruct the vertices table based on the source and target information.
- pgr_analyzeGraph - to analyze the edges and vertices of the edge table.
- pgr_analyzeOneway - to analyze directionality of the edges.
- pgr_nodeNetwork -to create nodes to a not noded edge table.
Routing functions¶
- pgr_apspJohnson- All Pairs Shortest Path, Johnson’s Algorithm
- pgr_apspWarshall - All Pairs Shortest Path, Floyd-Warshall Algorithm
- pgr_astar - Shortest Path A*
- pgr_bdAstar - Bi-directional A* Shortest Path
- pgr_bdDijkstra - Bi-directional Dijkstra Shortest Path
- pgr_dijkstra - Shortest Path Dijkstra
- pgr_driving_distance - Driving Distance
- pgr_kDijkstra - Mutliple destination Shortest Path Dijkstra
- pgr_ksp - K-Shortest Path
- pgr_trsp - Turn Restriction Shortest Path (TRSP)
- pgr_tsp - Traveling Sales Person
Pre processing or post processing helping functions¶
Driving Distance post-processing
- pgr_alphaShape - Alpha shape computation
- pgr_pointsAsPolygon - Polygon around set of points
Experimental and Proposed functions¶
- This section contains new experimental or proposed signatures for any of the following sections:
- topology functions
- routing functions
- vehicle routing functions
- pre / post procesing helper functions
We are including them so that the pgRouting community can evaluate them before including them as an official function of pgRouting.
Some of them are unsupported like the GSoC functions.
Experimental functions: Proposed by Steve Woodbridge¶
- Convenience Functions
- pgr_pointToEdgeNode - convert a point geometry to a
vertex_id
based on closest edge. - pgr_flipEdges - flip the edges in an array of geometries so the connect end to end.
- pgr_textToPoints - convert a string of
x,y;x,y;...
locations into point geometries. - pgr_pointsToVids - convert an array of point geometries into vertex ids.
- pgr_pointsToDMatrix - Create a distance matrix from an array of points.
- pgr_vidsToDMatrix - Create a distance matrix from an array of
vertix_id
. - pgr_vidsToDMatrix - Create a distance matrix from an array of
vertix_id
.
- pgr_pointToEdgeNode - convert a point geometry to a
Experimental functions: by GSoC¶
- The following functions are experimental
- They may lack documentation,
- Were created by GSoC students.
- they are unsupported.
- pgr_vrpOneDepot - VRP One Depot
- pgr_vrppdtw - Pickup and Delivery problem - Pickup and Delivery problem
Proposed functions: Proposed by Zia Mohammed¶
- About this proposal:
- Author: Zia Mohammed.
- Status: Needs a lot of testing. I am working on that.
- I did not add automated test.
- Temporary name: pgr_labelGraph
- Need: I need feedback from the community.
- pgr_labelGraph - Analyze / label subgraphs within a network
Discontinued Functions¶
Developer¶
Warning
In V3.0 This function are going to be discontinued. Use the already available underscored version instead.
Warning
Developers’s Functions documentation is going to be deleted from the pgRouting documentation in V3.0
- The following functions are used internaly the topology functions.
- pgr_getColumnName - to get the name of the column as is stored in the postgres administration tables.
- pgr_getTableName - to retrieve the name of the table as is stored in the postgres administration tables.
- pgr_isColumnIndexed - to check if the column is indexed.
- pgr_isColumnInTable - to check only for the existance of the column.
- pgr_pointToId -to insert/get the id of the inserted point in a vertices table.
- pgr_quote_ident - to quotes the input text to be used as an identifier in an SQL statement string.
- pgr_versionless - to compare two version numbers.
- pgr_startPoint - to get the start point of a (multi)linestring.
- pgr_endPoint - to get the end point of a (multi)linestring.
Indices and tables