In this section, the three different band render types that are appropriate for singleband rasters will be covered. Singleband rasters can be styled using three different band render types: paletted, singleband gray, and singleband pseudocolor.
Note that even though raster color rendering and resampling are part of raster style properties, they will be discussed separately in later sections as they are common to all singleband and multiband raster renderers.
The raster band render type should be chosen to best match the type of data. For instance, a palette renderer is best used on rasters that represent discrete data, such as land use classes. The singleband gray would be a good choice for a hillshade, while a singleband pseudocolor would work well on a raster containing global temperature data.
The paletted raster band renderer applies a single color to a single raster value. QGIS supports the loading of rasters with paletted colors stored within and the changing of the color assigned to the raster value. QGIS does not currently support the creation of color palettes for singleband rendering. However, existing QGIS layer style files (.qml
) that contain palettes can be applied by clicking on the Load Style button in the layer properties.
As an example of a raster with a color palette stored within it, add NA LC 1km.tif
from the sample data to the QGIS canvas and open the Style tab under Layer Properties. The following figure shows the Paletted band renderer being applied to Band 1 of the raster:
To change a color, double-click on a color in the Color column to open the color picker.
The singleband gray band renderer stretches a gradient between black and white to a single raster band. Additionally, contrast enhancements are available to adjust the way the gradient is stretched across the raster band's values. Let's apply a singleband gray renderer and a contrast enhancement to the sample GRAY_50M_SR_W.tif
raster file that represents shaded relief, hypsography, and flat water for Earth.
Add GRAY_50M_SR_W.tif
to the QGIS canvas and open its Style tab from Layer Properties. As this is a singleband raster, QGIS defaults the Render type value to Singleband gray with the following parameters (as shown in the next screenshot):
105
(the minimum cell value found in the gray band)207
(the maximum cell value found in the gray band)The Min, Max, and Contrast enhancement parameters work together to determine how to stretch the color gradient to the gray band. To understand how these parameters work together, we need to first discuss how the Min and Max values are derived, which draws our attention to the Load min/max values section of the Band rendering options. The Load min/max values section contains parameters that are used to calculate which Min and Max values should be set. Three sets of parameters must be set before you click on the Load button; they are as follows:
2%
and 98%
of the cell data range were included. In general, this will remove the few very high and very low values that may skew the gradient.With the Load min/max values set, click on the Load button to calculate the Min and Max values. With the Min and Max values set, we can turn our attention to the Contrast enhancement parameter. The Contrast enhancement parameter sets how to stretch the color gradient across the cell values of the gray band. The following four methods are available for Contrast enhancement:
The following figure shows the effects of the four different Contrast enhancement methods on the
Gray_50M_SR_W.tif
sample file when the Color gradient field is set to Black to white, Min is set to 107
, and Max is set to 207
. A Min value of 107
is selected to exclude the cell value of 106
that is associated with the oceans.
The singleband pseudocolor band renderer stretches a color ramp to a single raster band. Additionally, three Color interpolation methods are available to adjust the way the color ramp is stretched across the raster band's values with respect to the min and max cell values (for a discussion on determining min and max values, see the preceding section).
Let's apply a singleband pseudocolor renderer to the GRAY_50M_SR_W.tif
sample data raster file that represents shaded relief, hypsography, and flat water for Earth. Add GRAY_50M_SR_W.tif
to the QGIS canvas and open its Style tab from Layer Properties. For the Render type field, choose Singleband pseudocolor.
The singleband pseudocolor render type has many interworking parameters that are best explained as a whole through the lens of a workflow, instead of explaining them as separate parts. The example shown in the following screenshot will be the basis for explaining the parameters:
Using the preceding image for reference, complete the following steps:
The color ramp can be applied to the raster cell values in a Continuous or Equal interval classification mode terminating at the Min and Max values:
105
, and the Max value to 207
.The last step is to choose the Color interpolation method. The following three methods are available and they have a significant effect on how the raster will be rendered:
The following figure shows the effects of the three Color interpolation methods on our sample data as configured so far:
Optionally, you could check Clip (below the classification list); this would not assign colors to values outside the maximum and minimum values listed in the classification list.
These three singleband render types (paletted, singleband gray, and singleband pseudocolor) provide a large amount of flexibility and customization to fit your styling needs. The next section covers the remaining band render type that is best applied to multiband rasters: multiband color.