Topology in QGIS


Topology rules define the permissible relationships of features within a given GIS layer or between features in two different GIS layers. An example is that features in a road dataset must be connected to other roads at both ends, unless the road is specified as a dead end street.

Advantage of topology over queries

A lot of the checks that topology rules carry out could be achieved using spatial queries. You may have to use queries if the GIS software you’re using doesn’t have a topology feature.

Topology rules have the advantage that they only need be created once and then they can check your work as you go.

Queries would need to be re-created each time they are run. They can be saved, depending on the GIS being used, but this is still more time consuming and it is a task that must be carried out separately at the end of a work session.


QGIS 2.2 topology tool has the following rules pre-defined:-

  • End points must be covered by (e.g. a railway line usually begins and ends at a station)
  • Must contain (e.g. a building polygon must contain at least one address point seed)
  • Must not have dangles (a line must begin and end at another line)
  • Must not have duplicates (each feature should be unique, e.g. postcode areas)
  • Must not have gaps (e.g. administrative area polygons cannot have gaps)
  • Must not have invalid geometries
  • Must not have multi-part geometries (each feature should be a separate entry)
  • Must not overlap (e.g. administrative area polygons cannot overlap each other)
  • Must not overlap with (a feature from layer must not overlap with another layer)

Example 1 – Roads must not have dangles

The following example uses the “Must not have dangles” rule to identify polylines from a roads dataset that are not snapped to other lines. Roads usually begin and end at a junction with another road, so this is a useful rule to identify where lines were not correctly snapped together.

To create and validate a Topology Rule

  • Open the Topology Panel, by selecting Vector menu, Topology Checker, Topology Checker
  • The Topology Panel appears in the lower right corner of the QGIS desktop window


  • Press the Configure button to open the Topology Rule Settings dialog
  • The top of the box will have 2 or 3 pull down boxes depending on the layer and rule that is chosen. Use these to build the rule and then press the Add Rule button.


  • Press OK when done, the dialog box closes and the window returns to the QGIS Desktop.
  • Press either the Validate All or Validate extent, depending on whether you wish to validate the entire dataset or just the current view extent.
  • The errors will be listed. Double click on a row will make the map window zoom and pan to the error.



Tags: , , , , , , , ,

About Luke Nicolaides

I've been working in GIS for over 10 years. I've used MapInfo and ESRI's ArcMap at work in local government plus the water and environment industries. More recently I've been experimenting with QGIS. This blog will bring together some of my tips and tutorials.

8 responses to “Topology in QGIS”

  1. Antonio Locandro (@antoniolocandro) says :

    is it possible to define a rule where line ends are covered by points from either one layer or another?

    • Luke Nicolaides says :

      Yes the rule “End points must be covered by”rule should work. I just loaded a railway line layer and specified the rule “End points must be covered by” Stations (points layer).

  2. Nicky says :

    Is it possible to remove part of a street that has a dead-end without causing an error in the file for use in other programs (i.e., Netlogo). In this case, I have a street that extends and connects to two others on one end and is a dead-end on the other. Attempting to delete the dead-end node creates an error when opening the map in Netlogo.

    • Luke Nicolaides says :

      I’m not familiar with Netlogo. It is possible to edit a feature class in the usual way when using a topology checker in QGIS. However I haven’t tired exporting the edits to Netlogo, so I can’t comment on any problems with that.

  3. Diogo Caribé says :

    Is it possible export table’s erros?

  4. Marc Broadhurst says :

    First of all, thank you for this tutorial!
    Is there a shortcut to select the next line in the error’s report? Like Ctrl+enter for ArcGIS? Thank you!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: