Is your directional linear network driving you crazy?

Written by: | Posted on: | Category:

Using our experience fixing four river networks in Peru for the Peruvian Amazon Rural Livelihoods and Poverty (PARLAP) project, we have developed three OpenSource QGIS 3 models that will permit you to find and fix problems in your directional linear network (road, rivers...). Figure 1. Overall structure of the models

Model 1, “Check Geometries will look for, and identify topology errors in the linear network files. These errors include errors like duplicate nodes, self overlapping and zero length lines (Figure 2). This first model also converts multipart geometries to single part geometries. Problematic geometries and multipart geometries are clearly identified so that you can track changes.

Figure 2 Error checking by Model 1 - invalid geometries

Model 2, “Check Network, will identify 8 common network errors:

  • Disconnected lines (edges not connected to the graph)
  • Overlapping geometries (self overlap, multiple line overlap)
  • Parallel edges (lines that start and end at the same place or graph edges sharing the same first and last nodes, very problematic if you plan to use a simple graph)
  • Self connecting lines (like when using a lake shore instead of the lake central navigation line)
  • Disconnected crossing lines (these lines are crossing one on top of the other but not connected by a nodes)
  • Dangles (lines not touching the first or last node)
  • Lines that could be merged
  • Network vectorizing direction changes (indicating for example, a change in river current direction)

This second model will also create a graph from your network file and provide a nearest distance analysis on the disconnected line nodes to find a snapping radius for fixing the network. Remove the guesswork from the equation!

Figure 3. Graph output from the second model illustrating a potential problem in the network caused by disconnected end nodes

Figure 4. Graph output showing problems from all invalid geometries.

Model 3, “Snap Network will snap and break (split) disconnected lines to the network when two lines are found within the snapping radius identified by model two. All corrections are identified in order to track changes.

Figure 5. Output of the corrected network with the corrections identified

To download these models, visit and look for:

  • Fix Directional Network, Check Geometries, model 1 of 3
  • Fix Directional Network, Check Network, model 2 of 3
  • Fix Directional Network, Fix Network, model 3 of 3

Requires QGIS 3.20

An introduction to the models can be found on YouTube - check it out below:

Visit the project website at

You can also read A Python Algorithm for Shortest-Path River Network Distance Calculations Considering River Flow Direction for more details on linear networks (

Follow Nicolas on GitLab and Facebook

Applied Remote Sensing Lab

Department of Geography
McGill University
805 Sherbrooke West
Burnside Hall 705
Montreal, QC H3A 0B9


Coming soon!


© 2021 Margaret Kalacska Contact Me