How to use pgRouting to calculate driving distance?

How to use pgRouting to calculate driving distance?

In this tutorial we will learn to work with pgRouting tool in estimating the driving distance from all nearby nodes which can be very useful in supply chain, logistics and transportation based applications.

What is the pgRouting extension of PostGIS database?

pgRouting is an extension of PostGIS and PostgreSQL geospatial database. It adds routing and other network analysis functionality.

How to calculate the driving distance of a node?

Driving distance ( pgr_drivingDistance) is a query that calculates all nodes within the specified driving distance of a starting node. This is an optional function compiled with pgRouting; so if you compile pgRouting yourself, make sure that you enable it and include the CGAL library, an optional dependency for pgr_drivingDistance.

Which is the first step in pgRouting GIS?

First step is to load roads.shp into PostGIS. This is easy using PostGIS Manager – Data – Load Data from Shapefile. pgRouting requires each road entry to have a start and an end node id. If your dataset already contains this information, you can skip this step.

Where can I find a pgRouting enabled database?

Congratulations, you now have a pgRouting-enabled database. The following description is based on the free road network published by National Land Survey of Finland (NLS) (Update January 2013: Sorry, this dataset has been removed).

How to build a pgRouting database from source?

Building from source is covered by pgRouting documentation. If you’re using Windows, download the binaries and copy the .dlls into PostGIS’ lib folder, e.g. C:\\Program Files (x86)\\PostgreSQL\\8.4\\lib. Start pgAdmin and create a new database based on your PostGIS template. (I called mine ‘routing_template’.)

How to create start and end node IDs in pgRouting?

pgRouting requires each road entry to have a start and an end node id. If your dataset already contains this information, you can skip this step. Otherwise we will create the node ids now. (Update: pgRouting also offers a special function called assign_vertex_id that will create start and end node ids for your network table.