This section of the free chapter preview of Mastering QGIS looks at editing GIS data in QGIS. Mastering QGIS is designed to bring users who want to go beyond the basics of QGIS to an advanced level of QGIS expertise.
Vector data layers can be edited within QGIS Desktop. Editing allows you to add, delete and modify features in vector data sets. The first step is to put the data set into edit mode. Select the layer in the Layers panel and click Layer | Toggle Editing. Alternatively you can right click on a layer in the Layers panel and choose Toggle Editing from the context menu. Multiple layers can be edited at a time. The layer currently being edited is the one selected in the Layers panel. Once in edit mode the Digitizing Toolbar can be used to add, delete and modify features.
From left to right the tools are:
- Current Edits allows you to manage your editing session. Here you can save and rollback edits for one or more selected layers.
- Toggle Editing provides an additional means of beginning or ending an editing session for a selected layer.
- Save Layer Edits allows you to save edits for the selected layer(s) during an editing session.
- The Add Features tool will change to the appropriate geometry depending on whether a point, line or polygon layer is selected. Points and vertices of lines and polygons are created by left clicking. To complete a line or polygon feature right click. After adding a feature you will be prompted to enter the attributes.
- Features can be moved with the Move Tool by clicking them and dragging them to the new position.
- Individual feature vertices can be moved with the Node Tool. Click on a feature once with the tool to select it, the vertices will change to red boxes. Click again on an individual vertex to select it. The selected vertex will turn to a dark blue box. From there the vertex can be moved to the desired location. Additionally, edges between vertices can be selected and moved. To add vertices to a feature, simply double click on the edge where you want the vertex to be added. Selected vertices can be deleted by clicking the Delete key on the keyboard.
- Features can be deleted, cut, copied and pasted with the Delete Selected, Cut Features, Copy Features, and Paste Features
Snapping is an important editing consideration. It is a specified distance (tolerance) within which vertices of one feature will automatically align with vertices of another feature. The specific snapping tolerance can be set project wide or per layer. The method for setting the snapping tolerance for a project varies by operating system:
- Windows: Settings | Options | Digitizing.
- Mac: QGIS | Preferences | Digitizing
- Linux: Edit | Options | Digitizing
In addition to setting the snapping tolerance, here the snapping mode can also be set to vertex, segment or vertex and segment. Snapping can be set for individual layers by clicking Settings | Snapping Options. Individual layer snapping settings will override those of the project.
There are many digitizing options that can be set from Settings | Options | Digitizing. These include settings for: Feature Creation, Rubberband, Snapping, Vertex markers and Curve Offset Tool. There is also an Advanced Digitizing toolbar which is covered in Chapter 6.