pgRouting is an extension of PostGIS (geospatial database), which in turn, is an extension of PostgreSQL database system. It adds routing capabilities and network analysis functionalities to the PostGIS geospatial database. You can perform different network analysis, shortest paths, driving distances, service areas on a topological corrected network.

To be able to perform route analysis in QGIS using pgRouting you have to follow some specific steps as follow:

  1. Install PostgreSQL
  2. Install PostGIS and pgRouting
  3. With pgAdmin (that comes installed along with PostgreSQL) connect to the database and create a new one, enable its spatial and routing capabilities.
  4. Import the network layer into the database.
  5. Use QGIS and connect to the newly created database. Use Browser Panel > PostGIS > New connection.
  6. Create all the necessary attributes needed for route computation – length, speed, time to cross all the sections of the network. They can be called also, cost of crossing (for a section of the road).
  7. Check the network topology with Topology Checker. Also create the PostGIS topology using pgAdmin.
  8. Install the pgRouting Layer plugin.

After all these steps you should be able to load the layer into QGIS map canvas from your PostGIS database just created.


Now we are ready to perform route analysis using pgRouting.  Go to View > Panels > pgRouting Layer.


Clicking Preview, the algorithm will compute the shortest route between the selected points (start and end).


For more details please consult our QGIS Advanced level course.

QGIS Adavanced Level