Lab4 TopologyQGIS
Lab4 TopologyQGIS
Data: Data are in the Lab4 subdirectory, some for an area in France in a
french national coordinate system, and a second set that defines a study
area in southern Dakota County, Minnesota.
Creating Topology
As noted in the readings, topology specifies the spatial relationships, or
constraints, among features in a layer and among features in different
layers.
There are many possible rules for polygon topology, described at the QGIS
webpage
https://docs.qgis.org/3.10/en/docs/gentle_gis_introduction/topology.html
You set up a topology by specifying rules, and then indicate which layers
participate in each rule. Some rules require only one layer, some have two
participants, and some more than two.
One commonly applied rule is a layer “Must not have gaps.” This applies to
only the single participating layer and implies that there can be no slivers
or uncovered pieces.
1
Lab 4, QGIS 3 Topology and Advanced Editing
Here is an example of a layer with an error in the “Must not have gaps”
rule:
The figure below shows “Cannot overlap” errors where the dark blue
features, in one layer, partially cover light blue features in another layer.
The errors are flagged after validating the topology, as shown below, lower
right.
There are similar, but fewer and simpler, rules for point and line topology
which we won’t discuss here. If you understand and master the polygon
tools you shouldn’t have trouble with point and line topologies.
2
Lab 4, QGIS 3 Topology and Advanced Editing
These data layers area all in a common local coordinate system, the
French RGF 1993 CC43. This has the EPSG code of 3943.
We want to check for and fix slivers or gaps between the landcover
polygons, that the buildings do not overlap with the roads, and that the
storm sewers fall within the roads layers.
Open QGIS, create a new project, and set the project coordinate system to
EPSG 3943.
3
Lab 4, QGIS 3 Topology and Advanced Editing
4
Lab 4, QGIS 3 Topology and Advanced Editing
http://mt0.google.com/vt/lyrs=y&hl=en&x={x}&y={y}&z={z}
http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1
Add the Bes_LandCov.gpks data sets to your project, zoom to the layer
extent, and change the fill color to transparent and outline color and width
to something visible, e.g.:
5
Lab 4, QGIS 3 Topology and Advanced Editing
Checking Topology
Make of copy of the
Bes_LandCover data
layer (right click on layer,
then Export -> Save
Features As), named
something like
Bes_LCWorking, and
remove the original from
your project. This way, if
you make an irreversible
mistake, you can load the
original layer and start
over.
We need to check the topology for this layer. We test topology via
the Topology Checker, which is a standard plugin that should come
installed as part of the QGIS 3 system. (video: Topology checker)
Unfortunately, the plugin may not be activated by default, so you may have
to find and activate it manually.
The topology checker should appear near the bottom (plugins are listed in
alphabetical order).
After closing the plugin window, you should now see the Topology Checker
icon among your toolbars.
6
Lab 4, QGIS 3 Topology and Advanced Editing
meaning polygons in
the layer must not
overlap with each
other.
8
Lab 4, QGIS 3 Topology and Advanced Editing
We need to identify errors and fix them (video, fixing simple topological
errors).
9
Lab 4, QGIS 3 Topology and Advanced Editing
We can modify the edge of one polygon to match the adjacent polygon.
From last week’s lab, you should know how to set up a data layer for
digitizing. Activate snapping, snap to vertexes and segments, and set a
snap tolerance of about 3 meters.
10
Lab 4, QGIS 3 Topology and Advanced Editing
You
should now have three errors,
with the overlap you just fixed no
longer in the list.
Validate again, and note that the error has disappeared (or re-edit until it
does).
There should still be two gap errors, typically with a solid color, here red.
11
Lab 4, QGIS 3 Topology and Advanced Editing
Clean up all the errors, validate until there are no errors listed in the table,
and save your Bes_LCworking layer.
Remove the landcover layer, and add the Bes_Buildings and Bes_Roads
layers to your map canvas.
Create a new project, set the coordinate system to EPSG: 26915, the
NAD83 Zone 15N UTM coordinate
system.
Create a topological rule set indicating that polygons in the layer must not
have gaps, and must not overlap.
13
Lab 4, QGIS 3 Topology and Advanced Editing
This should open a creation window. Fill it out as shown below, with any
name you wish, and use the web service link below for the URL:
https://imageserver.gisdata.mn.gov/cgi-bin/wms?
services often have more detailed and useful data than the generic
Google, Microsoft, ESRI, or Open Street Map services.
Expand the MnGEO entry in the browser window, you should see
Regional, Twin Cities metro, and Statewide categories.
15
Lab 4, QGIS 3 Topology and Advanced Editing
You can modify the brightness and other image display characteristics to
improve viewing.
Right click on the WMS image entry in your table of contents, and select
Properties -> Symbology to get a layer properties window.
Brightness, contrast, and saturation sliders allow you to change the image,
usually lightening or darkening to improve visibility while digitizing.
16
Lab 4, QGIS 3 Topology and Advanced Editing
This allows you to move vertices and edges associated with shared nodes.
Topological editing helps avoid new gap and overlap errors while editing.
17
Lab 4, QGIS 3 Topology and Advanced Editing
then:
When topological editing is activated, vertex/node edits should drag the net
of connected lines to a new position, keeping polygon integrity intact.
Load the Randolph Parcels data layer you fixed in the previous portion of
this lab, and open it for editing.
18
Lab 4, QGIS 3 Topology and Advanced Editing
Activate the vertex editing tool and edit the offending line,
dragging the nodes and vertices from in the road to a bit past the
road edge. You should see something similar to the figure at right
as you drag:
Continue repositioning
along the road margin
until there are no more offending polygons.
As shown earlier in this and the previous labs, use the select,
19
Lab 4, QGIS 3 Topology and Advanced Editing
split,
to extend the right of way through these polygons, for something like this:
When you have finished digitizing and saved your edits, create and apply
topology rules to ensure the parcels polygons do not overlap, and do not
have gaps.
Create a map containing your final, error-free parcel layer, with an image
background, and the usual north arrow, title, legend, and scale bar
elements, and export a PDF.
20
Lab 4, QGIS 3 Topology and Advanced Editing
Here the mis-matches are probably because the data sets were developed
by different organizations at different times, the town boundary from a
county GIS office, and landcover boundaries from a state department in
charge of natural resources.
21
Lab 4, QGIS 3 Topology and Advanced Editing
We may have a project for which these layers need to match. You’ll edit
the land cover layer to ensure the
boundaries are consistent.
You can verify this is set by Opening Snapping Options, and noting that
you are using Topological Editing and snapping to All Layers:
Edit the landcover layer to fix the offending borders, similar to the figure.
Note that again, there might be an instance or two where topological
editing doesn’t move both landcover polygon edges, and you’ll have to
reposition the second edge independently. Remember, making the edit
layer semi-transparent helps show these cases.
After matching the borders and saving, create a topology table to check
and fix gaps and overlaps in the landcover layer.
When finished, create a map with the parcels and fixed landcover layer,
and add a north arrow, legend, scale bar, and title, and export as a PDF.
22