Checking the topology of vector data

In GIS, there are two main data models: vector and raster. They are called models because they are not real but are representations of the real world. It is important that we ensure our data is modeling the world as accurately as possible. Vector datasets often have hundreds or thousands of features, making it nearly impossible to verify each feature. However, using topology rules, we can let QGIS evaluate the geometry of our datasets and ensure that they are well constructed.

Topology is the relationship between contiguous or connected features in a GIS. Here, you will be introduced to the topology checker plugin. This plugin allows you to test topological relationships in your data and ensure that they are modeling the real world accurately. An example of a topological relationship rule is polygons must not overlap. Imagine a country boundaries dataset. It is not possible for a point to be in two countries at once. Therefore, polygons in such a dataset should not overlap. The topology checker plugin can be used to test whether there are any overlapping polygons.

Installing the topology checker

Here are the steps for installing the topology checker plugin:

  1. Navigate to Plugins | Manage and Install Plugins and click on the All tab.
  2. In the search bar, type topology.
  3. Select the Topology Checker plugin and click on Install plugin.
  4. Once enabled, the Topology Checker plugin can be found by navigating to Vector | Topology Checker.
  5. When the Topology Checker window opens, it appears as a panel in QGIS Desktop.

Topological rules

Different sets of topological rules are available depending on the feature geometry: point, line, or polygon. Some rules test for relationships between features in a single layer and some test the relationships between features of two separate layers. All participating layers need to be loaded into QGIS. The following topological rule tests are available.

Rules for point features

The rules for point features are as follows:

  • must be covered by: This relationship test evaluates how a point layer interacts with a second vector layer. Points that do not intersect the second layer are flagged as errors.
  • must be covered by endpoints of: This relationship test evaluates how a point layer interacts with a line layer. Points that do not intersect the endpoints of the second layer are flagged as errors.
  • must be inside: This evaluates how a point layer interacts with a second polygon layer. Points not covered by the polygons are flagged as errors.
  • must not have duplicates: This evaluates if point features are stacked on top of one another. Additional points with the same x and y position (stacked) as the first point queried are flagged as errors.
  • must not have invalid geometries: This checks whether the geometries are valid and if they are not, then it flags those features as errors.
  • must not have multi-part geometries: This flags all multi-part points as errors.

Rules for line features

The rules for line features are as follows:

  • end points must be covered by: This relationship test evaluates how a line layer interacts with a second point layer. The features that do not intersect the point layer are flagged as errors.
  • must not have dangles: This test will flag features that are dangling arcs.
  • must not have duplicates: This flags additional duplicate line segments (stacked) as errors.
  • must not have invalid geometries: This checks whether the geometries are valid and if they are not, then it flags those features as errors.
  • must not have multi-part geometries: This flags features that have a geometry type of multi-line as errors.
  • must not have pseudos: This tests lines for the presence of pseudo nodes. This is when there is a pair of nodes where there should only be one. These can interfere with network analysis. The features with pseudo nodes will be flagged as errors.

Rules for polygon features

The rules for polygon features are as follows:

  • must contain: This checks whether the target polygon layer contains at least one node or vertex from the second layer. If it doesn't, it is flagged as an error.
  • must not have duplicates: This flags additional duplicated stacked polygons as errors.
  • must not have gaps: This flags adjacent polygons with gaps as errors. Watersheds or parcel boundaries would be suitable for this test.
  • must not have invalid geometries: This checks whether the geometries are valid. Some of the rules that define a valid geometry are as follows:
    • Polygon rings must close
    • Rings that define holes should be inside rings that define exterior boundaries
    • Rings should not self-intersect (they may neither touch nor cross one another)
    • Rings should not touch other rings, except at a point
  • must not have multi-part geometries: This flags all multi-part polygons as errors.
  • must not overlap: This flags adjacent polygon features in the same layer that overlap one another as errors. Watersheds or parcel boundaries would be suitable for this test.
  • must not overlap with: This relationship test evaluates how polygon features from the target layer interact with polygon features from a second polygon layer. Those that do will be flagged as errors.

Using the topology checker

The parcels.shp sample data will be used to demonstrate how to set up and test topological relationships. Here, the parcels polygon shapefile is loaded and the Topology Checker panel has been enabled by clicking on the Topology Checker button Using the topology checker or Topology Checker under the Vector menu. The following screenshot shows the parcels.shp sample data loaded into QGIS Desktop and the Topology Checker plugin enabled:

Using the topology checker

Here are the steps for configuring the Topology Checker plugin and evaluating the topology of the parcels.shp sample data:

  1. Click on the Configure button Using the topology checker in the Topology Checker panel to open the Topology Rule Settings dialog.
  2. To set a rule, choose the target layer, parcels.
  3. Next, choose the must not have gaps rule from the central drop-down menu:
    Using the topology checker

    Tip

    The list of available rules changes depending upon which target layer is chosen.

  4. Since this rule involves only the target layer, the final drop for a second layer disappears.
  5. Now, we will add a second rule. Set the target layer to parcels and the rule as must not overlap.
  6. Click on the Add Rule button (Using the topology checker).
  7. For the third rule, again set the target layer to parcels and set the rule as must not have duplicates.
  8. Click on the Add Rule button.
  9. For this example, we will test three rules against the parcels layer:
    • must not have gaps
    • must not overlap
    • must not have duplicates
  10. The rules that have been established are summarized in the Topology Rule Settings dialog box:
    Using the topology checker
  11. A rule can be deleted by selecting it and choosing Delete Rule (Using the topology checker).
  12. Click on OK when the topological rules have been defined.

    Tip

    As of version 0.1 of the Topology Checker plugin, the Tolerance setting is not operational. If it were, it would allow a tolerance to be set in map units. For example, one could test whether a bus stop's layer (point) is within 50 feet of the centerline of a road (line) by setting a tolerance of 50 feet and using the must be covered by rule.

  13. Once the topology rules have been set, you can choose to validate the topology for the entire layer (Validate All) or just within the current map extent (Validate Extent).
  14. For this example, choose Validate AllUsing the topology checker.
  15. The topology errors are displayed in the Topology Checker Panel. In this case, 17 errors are found including six gaps, nine overlaps, and two duplicate geometries, as shown in the following screenshot:
    Using the topology checker
  16. The Show errors box can be checked to see where in the dataset the errors occur. Errors will be highlighted in red, as shown in the following figure:
    Using the topology checker
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.2.184