Vector data layers can be edited within QGIS Desktop. Editing allows you to add, delete, and modify features in vector datasets. The first step is to put the dataset into edit mode. Select the layer in the Layers panel and click on Toggle Editing under Layer. 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 you are in the edit mode, the digitizing toolbar (shown in the following screenshot) can be used to add, delete, and modify features.
From left to right, the tools in the digitizing toolbar are as follows:
- The Current Edits tool allows you to manage your editing session. Here, you can save and rollback edits for one or more selected layers.
- The Toggle Editing tool provides an additional means to begin or end an editing session for a selected layer.
- The Save Layer Edits tool 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 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 on 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 and the vertices will change into red boxes. Click again on an individual vertex to select it. The selected vertex will turn into a dark-blue box. Now, 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 pressing the Delete key on the keyboard.
- Features can be deleted, cut, copied, and pasted using the Delete Selected, Cut Features, Copy Features, and Paste Features tools.
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 for the whole project or per layer. The method for setting the snapping tolerance for a project varies according to the operating system, which is as follows:
- For Windows, navigate to Settings | Options | Digitizing
- For Mac, navigate to QGIS | Preferences | Digitizing
- For Linux, navigate to 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 navigating to Settings | Snapping Options. Individual layer snapping settings will override those of the project. The following screenshot shows examples of multiple snapping option choices.
Note
There are many digitizing options that can be set by navigating to 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, Advanced Data Creation and Editing.
When you load spatial data layers into QGIS Desktop, they are styled with a random single symbol rendering. To change this, navigate to Layer | Properties | Style.
There are several rendering choices available from the menu in the top-left corner, which are as follows:
In the preceding screenshot, the renderer is the layer symbol. For a given symbol, you can work with the first level, which gives you the ability to change the transparency and color. You can also click on the second level, which gives you control over parameters such as fill, border, fill style, border style, join style, border width, and X/Y offsets. These parameters change depending on the geometry of your layer. You can also use this hierarchy to build symbol layers, which are styles built from several symbols that are combined vertically.
You also have many choices when styling raster data in QGIS Desktop. There is a different choice of renderers for raster datasets, which are as follows:
- Singleband gray: This allows a singleband raster or a single band of a multiband raster to be styled with either a black-to-white or white-to-black color ramp. You can control contrast enhancement and how minimum and maximum values are determined.
- Multiband color: This is for rasters with multiple bands. It allows you to choose the band combination that you prefer.
- Paletted: This is for singleband rasters with an included color table. It is likely that it will be chosen by QGIS automatically, if this is the case.
- Singleband pseudocolor: This allows a singleband raster to be styled with a variety of color ramps and classification schemes.
The following is a screenshot of the Style tab of a raster file's Layer Properties showing where the aforementioned style choices are located:
Another important consideration with raster styling is the settings that are used for contrast enhancement when rendering the data. Let's start by loading the Jemez_dem.img
image and opening the Style menu under Layer Properties (shown in the figure below). This is an elevation layer and the data is being stretched on a black-to-white color ramp from the Min and Max values listed under Band rendering. By default, these values only include those that are from 2 percent to 98 percent of the estimation of the full range of values in the dataset, and cut out the outlying values. This makes rendering faster, but it is not necessarily the most accurate.
Next, we will change these settings to get a full stretch across all the data values in the raster. To do this, perform the following steps:
- Under the Load min/max section, choose Min / max and under Accuracy, choose Actual (slower).
- Click on Load.
- You will notice that the minimum and maximum values change. Click on Apply.
Tip
You can specify the default settings for rendering rasters by navigating to Settings | Options | Rendering. Here, the defaults for the Contrast enhancement, Load min/max values, Cumulative count cut thresholds, and the standard deviation multiplier can be set.
The blending modes allow for more sophisticated rendering between GIS layers. Historically, these tools have only been available in graphics programs and they are a fairly new addition to QGIS. Previously, only layer transparency could be controlled. There are now 13 different blending modes that are available: Normal, Lighten, Screen, Dodge, Addition, Darken, Multiply, Burn, Overlay, Soft light, Hard light, Difference, and Subtract. These are much more powerful than simple layer transparency, which can be effective but typically results in the underneath layer being washed out or dulled. With blending modes, you can create effects where the full intensity of the underlying layer is still visible. Blending mode settings can be found at the bottom of the Style menu under Layer Properties in the Layer Rendering section along with the Layer transparency slider. They are available for both vector and raster datasets.
In this example of using blending modes, we want to show vegetation data (Jemez_vegetation.tif
) in combination with a hillshade image (Jemez_hillshade.img
). Both data sets are loaded and the vegetation data is dragged to the top of the layer list. Vegetation is then styled with a Singleband pseudocolor renderer; you can do this by performing the following steps:
- Choose Random colors.
- Set Mode to Equal interval.
- Set the number of Classes to 13.
- Click on Classify.
- Click on Apply.
The following screenshot shows what the Style properties should look like after following the preceding steps.
At the bottom of the Style menu under Layer Properties, set the Blending mode to Multiply and the Contrast to 45 and click on Apply. The blending mode allows all the details of both the datasets to be seen. Experiment with different blending modes to see how they change the appearance of the image. The following screenshot shows an example of how blending and contrast settings can work together to make a raster 'pop' off the screen: