Topology in QGIS

Introduction

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.

Rules

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

Image

  • 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.

Image

  • 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.

Image

 

About these ads

Tags: , , , , , , , ,

About Luke Nicolaides

I've been working in GIS for over 10 years. I've used MapInfo and ESRI lots at work, and more recently I've started to experiment with QGIS. This blog will bring together some of my tips and tutorials.

4 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.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.

Join 211 other followers

%d bloggers like this: