Setting the QGIS snapping options is important. If you don’t you can create digitizing errors.
Introduction
Estimated reading time: 5 minutes
Setting the QGIS snapping options is important. If you don’t you can create digitizing errors. Two of the errors you’re likely to create when you’re digitizing in QGIS are shown in figure 1.
Although the map in the inset seems OK, when you zoom in you can see…
- gaps between the polygons and
- places where polygons overlap.
Neither gaps or overlaps are major problems if you’re only creating thematic maps. But both will cause errors when you’re making geographical queries…
- Because there is a gap there’s no way to tell that polygon A is next to polygon B.
- In topological GIS maps, the sliver between polygon B and polygon C will become a very small unattributed polygon. In non-topological GIS maps, polygon C will report as being larger than it should be.
The more sophisticated spatial databases that QGIS connects to such as Grass, Postgres, and Spatialite, are far more intelligent and far less forgiving than simple GIS formats such as shape files. Spatial databases use what are known as topological data structures.
Topology is where a polygon knows everything about every polygon that adjoins it. Spatial queries (eg. “how many m2 is 10 Smith St”) can be made directly to these databases without the need to involve QGIS.
In contrast, when you query a shape file, it’s QGIS that does the work to find information about adjoining polygons.
Why snapping options are important.
Ever heard the term “a sledgehammer to crack a nut”? For most small GIS projects, shape files are more than adequate. The important thing is to set your QGIS snapping options so that the problems you see in figure 1 don’t occur.
Because adjoining polygons must join each other “exactly” (figure 1), snapping options allow you to define how close you need to be to another polygon for the polygon you’re digitizing to automatically snap to it. You need to set these before you start. Otherwise your map will be rubbish!
I suggest that you begin by following the technique I set out below, and once you become comfortable with that, experiment using different combinations of the options. You’ll only understand the ins and outs of the QGIS snapping options once you take the time to play with them.
From the Project menu choose Snapping Options (figure 2). This box is where you set all the snapping options that allow you to digitize in a way that’s as topologically correct as is possible with a shape file (shape files don’t have true topology). By topology I mean that the QGIS snapping options allow you to digitize in a way that there are no overlaps in your maps. I explain below…
From the Project menu choose Snapping Options (figure 2). This box is where you set all the snapping options that allow you to digitize in a way that’s as topologically correct as is possible with a shape file (shape files don’t have true topology). By topology I mean that the QGIS snapping options allow you to digitize in a way that there are no overlaps in your maps. I explain below…
Following is an explanation of the numbered items in figure 3.
ID | Description |
1 | Click the horseshoe to enable the snapping options dialog. |
2 | Choose Advanced Configuration from the drop-down menu. You can choose to edit the Snapping Options for the Active Layer (selected in the Layers Panel), all the layers, or launch this Advanced dialog. |
3 | Check this box to enable the snapping options for a map. The map you check is the map you’re going to “snap” to. So, you can edit one map and snap to a different one! |
4 | This is where you choose what you’re going to snap to. The options are vertex, segment, vertex and segment. When you’re on-screen digitizing, each mouse click creates a vertex (sometimes called a node), and the bits between vertices are known as segments. |
5 & 6 | Snapping tolerance options are pixels or map units. In this example, if a vertex or segment is found within 12 pixels the mouse click is automatically moved to the closest vertex or segment. |
7 | Clicking this allows you to avoid overlapping adjoining polygons. In the absence of this you would have to digitize the vertices for adjoining polygons in the same place – a very tedious process. If you fail to set this correctly your map could end up looking like the one in Figure 1. |
8 | This option allows you to more easily maintain shared boundaries. Be sure to click it if you are digitizing polygons. |
Click the ‘X’ button in the top-right corner and dismiss the dialog.
Conclusion
With the QGIS snapping options set up you’re ready to digitize in QGIS. Most of the time I on-screen digitize from a georeferenced photo map.
If you would like to watch the videos that accompany this overview, and follow along with the dataset on your own computer, click this link to go to enrol in my 1.5 hour follow-along video QGIS 3 digitizing course
Good luck
Ian