How to Check Topology Error in QGIS

Topology Error

Topology defines mathematical relationship between features in geographic region. It describes a spatial connection between objects like overlap, touches, cross, intersect, within, etc. Topology is very important to check a data free from errors. There are some errors that can be found in a dataset such as overlap, gap, sliver polygon, undershoot and overshoot.

Overlap
Overlap is a topology error where a part or whole part of a feature occupies the same position with another feature. This become an error, because it is impossible for a feature to have same position with other. For example a parcel, it is not possible some part of it, is over another parcel.

Gap
Gap is a topology error which is opposite to overlap, where two adjacent features which share a common boundary, contains a blank area, which is no data. It is impossible for a parcel again which is neighbor with another parcel has no data area (blank area) around their common boundary.

Sliver polygon
Another topology error which can be found in polygon feature is sliver polygon. Sliver polygon happen where there is very small polygon along the common boundary. Or we could say when a gap is filled with polygon, then it becomes sliver polygon with a very small area. In figure 1 can be seen the illustration of these topology errors.

Overlap, gap and sliver polygon topology error
Figure 1. Overlap, gap and sliver polygon topology error
Additional topology error is undershoot and overshoot which are grouped as dangle.

Undershoot
Undershoot is a topology error that can be found in line dataset which is a line is not touching another line segment. For example a road which is represented by a line must be connected with other line at road intersection.

Overshoot
Opposites to undershoot, overshoot is a topology error when a line touch another line but it passes the line with a very short length. So when we zooming in to the intersection, the line is not stop at the boundary, but it passes it a little bit. In figure 2 can be seen the illustration of overshoot and undershoot topology error.
Overshoot and Undershoot topology error
Figure 2. Overshoot and Undershoot topology error

QGIS Topology Checker Plugin

Checking hundreds or even thousands features with topological error is tiring and time consuming. Because of that, we need a tool that can help us to check topology error. Topology Checker is a plugin in QGIS that can be used to check topology error. To use this plugin, make sure the topology checker plugin already installed. To install a plugin, click menu Plugins >> Manage and install plugins.. Then plugins window will appear as in figure 3. Type topology in search menu and topology checker plugin will be shown. Check the topology checker plugin and then push Install Plugin button.

Installing Topology Checker Plugin
Figure 3. Installing Topology Checker Plugin

 If the plugin already installed, then lets see how to check topology error.

Checking Undershoot and Overshoot (Dangle) Topology Error

Firstly we will check topology error for line feature. For this case I used road network dataset.
1. Add the road data to QGIS.
2. Open topology checker. You can use the topology checker's icon or access it from menu vector as in figure 4.

Topology Checker Menu
Figure 4. Topology Checker Menu
3. Topology checker panel will appear. Clik configure button as in figure 5. Topoloy Rule Settings window will appear.

Topology Checker Panel
Figure 5. Topology Checker Panel
4. Now come to very important step, defining rules. For identify undeshoot and overshoot error, the rule which applied is must not have dangles. Select Road layer then select the rule in the drop down list next to it. When finish select Add Rule Button. The layer and selected rule will be added to the list as in figure 6. Then click OK button.

Topology Rule Settings
Figure 6. Topology Rule Settings
5. After defining rule, in topology checker panel click button Validate All or Validate Extent. Validate All will check the topology error for the defined rule all over the data. On the other hand Validate Extent will check error in the extent of map view. If you have a big number of features (thousands) it will be better to validate in extent to speed up the process. The error will be shown in topology checker panel list and also will be marked on the map view with red marker as in figure 7.

Topology errors are marked with red marker
Figure 7. Topology errors are marked with red marker
6. Zoom in to the area with red marker to see the error clearly. You will see the error as in figure 8.

Dangle Error (Undershoot)
Figure 8. Dangle Error (Undershoot)

Checking Polygon Topology Error

We have checked the error for line feature. Now lets move to polygon feature. We will check for topology error such as overlap and gap.
1. Add polygon layer to QGIS. For this tutorial I used building polygon.
2. Click Topology Checker plugin. In the panel click Configure. The Topology Rule Settings window will appear as in figure 6. Choose the layer and then select rule must not overlap and must not have gaps. We have to add each rule one by one. See figure 9.
Topology Rule Settings for not overlap and gaps
Figure 9. Topology Rule Settings for not overlap and gaps
 
3. Click Validate, and then the error will appear and marked with red color as in figure 10.

Topology errors overlap and gaps
Figure 10. Topology errors overlap and gaps are marked with red color

Spatial Integrity

Last part of this tutorial we will talk about spatial integrity. What is spatial integrity? Spatial integrity is to make sure a data complies with the real condition as it is in the real world regarding with another data or features. To implement this spatial integrity we set the rule such as must contain, within, must not overlap with, must intersect with, etc.  For example in the real world, a road can not be overlapped with building. If there is a road which is overlapped with building, it can not be accepted because it is not comply with the real condition.

For this tutorial I used two data, road network and building with the rule must not overlap with. For this case both layers must be in polygon.
1. Add Road network polygon and Building to QGIS.
2. In Topology Rule Settings window, select Road for the first layer, then select rule must not overlap with and select Building for the second layer. See figure 11.
Topology Rule Settings for must not overlap with
Figure 11.Topology Rule Settings for must not overlap with
3. Click Validate. The error which is Road overlap with Building will be marked in red color as in figure 12.

Figure 12. Road which is overlapped with buildings are marked with red color
4. Zoom in to the red area in the map window to see the error clearly as in figure 13.
Figure 13. Zoom in to the overlap area
That's all the way how to check topology error in QGIS. Then how we can fix the error? The best way to fix the error is by manual editing, but it is not smart enough, tiring and time consuming. We need a better way to fix the topology error. I will show you in clean topology errror tutorial.

Related Posts

Disqus Comments