15.1. Raster Properties Dialog

To view and set the properties for a raster layer, double click on the layer name in the map legend, or right click on the layer name and choose Properties from the context menu. This will open the Raster Layer Properties dialog.

There are several tabs in the dialog:

小技巧

Live update rendering

The Layer Styling Panel provides you with some of the common features of the Layer properties dialog and is a good modeless widget that you can use to speed up the configuration of the layer styles and view your changes on the map canvas.

备注

Because properties (symbology, label, actions, default values, forms...) of embedded layers (see Nesting Projects) are pulled from the original project file, and to avoid changes that may break this behavior, the layer properties dialog is made unavailable for these layers.

15.1.1. Information Properties

The metadata Information tab is read-only and represents an interesting place to quickly grab summarized information and metadata for the current layer. Provided information are:

  • based on the provider of the layer (format of storage, path, data type, extent, width/height, compression, pixel size, statistics on bands, number of columns, rows and no-data values of the raster...);

  • picked from the provided metadata: access, links, contacts, history... as well as dataset information (CRS, Extent, bands...).

15.1.2. Source Properties

The system Source tab displays basic information about the selected raster, including:

  • the Layer name to display in the Layers Panel;

  • the Coordinate Reference System: Displays the layer's Coordinate Reference System (CRS). You can change the layer's CRS, by selecting a recently used one in the drop-down list or clicking on the setProjection Select CRS button (see Coordinate Reference System Selector). Use this process only if the layer CRS is a wrong or not specified. If you wish to reproject your data, use a reprojection algorithm from Processing or Save it as new dataset.

../../../_images/rasterPropertiesDialog.png

图 15.1 Raster Layer Properties - Source Dialog

15.1.3. Symbology Properties

15.1.3.1. Band rendering

QGIS offers many different Render types. The choice of renderer depends on the data type and the information you'd like to highlight.

  1. Multiband color - if the file comes with several bands (e.g. a satellite image with several bands).

  2. Paletted/Unique values - for single band files that come with an indexed palette (e.g. a digital topographic map) or for general use of palettes for rendering raster layers.

  3. Singleband gray - (one band of) the image will be rendered as gray. QGIS will choose this renderer if the file is neither multiband nor paletted (e.g. a shaded relief map).

  4. Singleband pseudocolor - this renderer can be used for files with a continuous palette or color map (e.g. an elevation map).

  5. Hillshade - Creates hillshade from a band.

  6. Contours - Generates contours on the fly for a source raster band.

Multiband color

With the multiband color renderer, three selected bands from the image will be used as the red, green or blue component of the color image. QGIS automatically fetches Min and Max values for each band of the raster and scales the coloring accordingly. You can control the value ranges in the Min/Max Value Settings section.

A Contrast enhancement method can be applied to the values: 'No enhancement', 'Stretch to MinMax', 'Stretch and clip to MinMax' and 'Clip to min max'.

备注

Contrast enhancement

When adding GRASS rasters, the option Contrast enhancement will always be set automatically to stretch to min max, even if this is set to another value in the QGIS general options.

../../../_images/rasterMultibandColor.png

图 15.2 Raster Symbology - Multiband color rendering

小技巧

Viewing a Single Band of a Multiband Raster

If you want to view a single band of a multiband image (for example, Red), you might think you would set the Green and Blue bands to Not Set. But the preferred way of doing this is to set the image type to Singleband gray, and then select Red as the Gray band to use.

Paletted/Unique values

This is the standard render option for singleband files that include a color table, where a certain color is assigned to each pixel value. In that case, the palette is rendered automatically.

It can be used for all kinds of raster bands, assigning a color to each unique raster value.

If you want to change a color, just double-click on the color and the Select color dialog appears.

It is also possible to assign labels to the colors. The label will then appear in the legend of the raster layer.

Right-clicking over selected rows in the color table shows a contextual menu to:

  • Change Color... for the selection

  • Change Opacity... for the selection

  • Change Label... for the selection

../../../_images/rasterPalettedUniqueValue.png

图 15.3 Raster Symbology - Paletted unique value rendering

The pulldown menu, that opens when clicking the ... (Advanced options) button below the color map to the right, offers color map loading (Load Color Map from File...) and exporting (Export Color Map to File...), and loading of classes (Load Classes from Layer).

Singleband gray

This renderer allows you to render a single band layer with a Color gradient: 'Black to white' or 'White to black'. You can change the range of values to color (Min and Max) in the Min/Max Value Settings.

A Contrast enhancement method can be applied to the values: 'No enhancement', 'Stretch to MinMax', 'Stretch and clip to MinMax' and 'Clip to min max'.

../../../_images/rasterSingleBandGray.png

图 15.4 Raster Symbology - Singleband gray rendering

Singleband pseudocolor

This is a render option for single-band files that include a continuous palette. You can also create color maps for a bands of a multiband raster.

../../../_images/rasterSingleBandPseudocolor.png

图 15.5 Raster Symbology - Singleband pseudocolor rendering

Using a Band of the layer and a values range, three types of color Interpolation are available:

  • Discrete (a <= symbol appears in the header of the Value column)

  • Linear

  • Exact (an = symbol appears in the header of the Value column)

The Color ramp drop down lists the available color ramps. You can create a new one and edit or save the currently selected one. The name of the color ramp will be saved in the configuration and in the QML file.

The Label unit suffix is a label added after the value in the legend.

For classification Mode selectString 'Equal interval', you only need to select the number of classes selectNumber and press the button Classify. For Mode selectString 'Continuous', QGIS creates classes automatically depending on Min and Max.

The button signPlus Add values manually adds a value to the table. The button signMinus Remove selected row deletes a value from the table. Double clicking in the Value column lets you insert a specific value. Double clicking in the Color column opens the dialog Change color, where you can select a color to apply for that value. Further, you can also add labels for each color, but this value won't be displayed when you use the identify feature tool.

Right-clicking over selected rows in the color table shows a contextual menu to:

  • Change Color... for the selection

  • Change Opacity... for the selection

You can use the buttons fileOpen Load color map from file or fileSaveAs Export color map to file to load an existing color table or to save the color table for later use.

The checkbox Clip out of range values allows QGIS to not render pixel greater than the Max value.

Hillshade

Render a band of the raster layer using hillshading.

../../../_images/rasterHillshade.png

图 15.6 Raster Symbology - Hillshade rendering

選項:

  • Band: The raster band to use.

  • Altitude: The elevation angle of the light source (default is 45°).

  • Azimuth: The azimuth of the light source (default is 315°).

  • Z Factor: Scaling factor for the values of the raster band (default is 1).

  • checkbox Multidirectional: Specify if multidirectional hillshading is to be used (default is off).

Contours

This renderer draws contour lines that are calculated on the fly from the source raster band.

../../../_images/rasterContours.png

图 15.7 Raster Symbology - Contours rendering

選項:

  • Input band: the raster band to use.

  • Contour interval: the distance between two consecutive contour lines

  • Contour symbol: the symbol to apply to the common contour lines.

  • Index contour interval: the distance between two consecutive index contours, that is the lines shown in a distinctive manner for ease of identification, being commonly printed more heavily than other contour lines and generally labeled with a value along its course.

  • Index contour symbol: the symbol to apply to the index contour lines

  • Input downscaling: Indicates by how much the renderer will scale down the request to the data provider (default is 4.0).

    For example, if you generate contour lines on input raster block with the same size as the output raster block, the generated lines would contain too much detail. This detail can be reduced by the "downscale" factor, requesting lower resolution of the source raster. For a raster block 1000x500 with downscale 10, the renderer will request raster 100x50 from provider. Higher downscale makes contour lines more simplified (at the expense of losing some detail).

Setting the min and max values

By default, QGIS reports the Min and Max values of the band(s) of the raster. A few very low and/or high values can have a negative impact on the rendering of the raster. The Min/Max Value Settings frame helps you control the rendering.

../../../_images/rasterMinMaxValues.png

图 15.8 Raster Symbology - Min and Max Value Settings

Available options are:

  • radioButtonOff User defined: The default Min and Max values of the band(s) can be overridden

  • radioButtonOff Cumulative count cut: Removes outliers. The standard range of values is 2% to 98%, but it can be adapted manually.

  • radioButtonOn Min / max: Uses the whole range of values in the image band.

  • radioButtonOff Mean +/- standard deviation x: Creates a color table that only considers values within the standard deviation or within multiple standard deviations. This is useful when you have one or two cells with abnormally high values in a raster layer that impact the rendering of the raster negatively.

Calculations of the min and max values of the bands are made based on the:

  • Statistics extent: it can be Whole raster, Current canvas or Updated canvas. Updated canvas means that min/max values used for the rendering will change with the canvas extent (dynamic stretching).

  • Accuracy, which can be either Estimate (faster) or Actual (slower).

备注

For some settings, you may need to press the Apply button of the layer properties dialog in order to display the actual min and max values in the widgets.

15.1.3.2. Color rendering

For all kinds of Band rendering, the Color rendering set.

You can achieve special rendering effects for your raster file(s) by using one of the blending modes (see Blending Modes).

Further settings can be made by modifying the Brightness, Saturation, Gamma and Contrast. You can also use a Grayscale option, where you can choose between 'Off', 'By lightness', 'By luminosity' and 'By average'. For one Hue in the color table, you can modify the 'Strength'.

15.1.3.3. Resampling

The Resampling option has effect when you zoom in and out of an image. Resampling modes can optimize the appearance of the map. They calculate a new gray value matrix through a geometric transformation.

../../../_images/rasterRenderAndResampling.png

图 15.9 Raster Symbology - Color rendering and Resampling settings

When applying the 'Nearest neighbour' method, the map can get a pixelated structure when zooming in. This appearance can be improved by using the 'Bilinear' or 'Cubic' method, which cause sharp edges to be blurred. The effect is a smoother image. This method can be applied to for instance digital topographic raster maps.

At the bottom of the Symbology tab, you can see a thumbnail of the layer, its legend symbol, and the palette.

15.1.4. Transparency Properties

transparency QGIS has the ability to set the transparency level of a raster layer. Use the transparency slider slider to set to what extent the underlying layers (if any) should be visible through the current raster layer. This is very useful if you overlay raster layers (e.g., a shaded relief map overlayed by a classified raster map). This will make the look of the map more three dimensional.

../../../_images/rasterTransparency.png

图 15.10 Raster Transparency

Additionally, you can enter a raster value that should be treated as an Additional no data value.

An even more flexible way to customize the transparency is available in the Custom transparency options section:

  • Use Transparency band to apply transparency for an entire band.

  • Provide a list of pixels to make transparent with corresponding levels of transparency:

    1. Click the signPlus Add values manually button. A new row will appear in the pixel list.

    2. Enter the Red, Green and Blue values of the pixel and adjust the Percent Transparent to apply.

    3. Alternatively, you can fetch the pixel values directly from the raster using the contextHelp Add values from display button. Then enter the transparency value.

    4. Repeat the steps to adjust more values with custom transparency.

    5. Press the Apply button and have a look at the map.

    As you can see, it is quite easy to set custom transparency, but it can be quite a lot of work. Therefore, you can use the button fileSave Export to file to save your transparency list to a file. The button fileOpen Import from file loads your transparency settings and applies them to the current raster layer.

15.1.5. Histogram Properties

The rasterHistogram Histogram tab allows you to view the distribution of the values in your raster. The histogram is generated when you press the Compute Histogram button. All existing bands will be displayed together. You can save the histogram as an image with the fileSave button.

At the bottom of the histogram, you can select a raster band in the drop-down menu and Set min/max style for it. The actionRun Prefs/Actions drop-down menu gives you advanced options to customize the histogram:

  • With the Visibility option, you can display histograms for individual bands. You will need to select the option radioButtonOff Show selected band.

  • The Min/max options allow you to 'Always show min/max markers', to 'Zoom to min/max' and to 'Update style to min/max'.

  • The Actions option allows you to 'Reset' or 'Recompute histogram' after you have changed the min or max values of the band(s).

../../../_images/rasterHistogram1.png

图 15.11 Raster Histogram

15.1.6. Rendering Properties

In the rendering Rendering tab, it's possible to:

  • set Scale dependent visibility for the layer: You can set the Maximum (inclusive) and Minimum (exclusive) scale, defining a range of scales in which the layer will be visible. It will be hidden outside this range. The mapIdentification Set to current canvas scale button helps you use the current map canvas scale as a boundary. See Scale Dependent Rendering for more information.

  • Refresh layer at interval (seconds): set a timer to automatically refresh individual layers. Canvas updates are deferred in order to avoid refreshing multiple times if more than one layer has an auto update interval set.

../../../_images/rasterRendering.png

图 15.12 Raster Rendering

15.1.7. Pyramids Properties

High resolution raster layers can slow navigation in QGIS. By creating lower resolution copies of the data (pyramids), performance can be considerably improved, as QGIS selects the most suitable resolution to use depending on the zoom level.

You must have write access in the directory where the original data is stored to build pyramids.

From the Resolutions list, select resolutions at which you want to create pyramid levels by clicking on them.

If you choose Internal (if possible) from the Overview format drop-down menu, QGIS tries to build pyramids internally.

备注

Please note that building pyramids may alter the original data file, and once created they cannot be removed. If you wish to preserve a 'non-pyramided' version of your raster, make a backup copy prior to pyramid building.

If you choose External and External (Erdas Imagine) the pyramids will be created in a file next to the original raster with the same name and a .ovr extension.

Several Resampling methods can be used for pyramid calculation:

  • Nearest Neighbour

  • Average

  • Gauss

  • Cubic

  • Cubic Spline

  • Laczos

  • Mode

  • None

Finally, click Build Pyramids to start the process.

../../../_images/rasterPyramids.png

图 15.13 Raster Pyramids

15.1.8. Metadata Properties

The editMetadata Metadata tab provides you with options to create and edit a metadata report on your layer. See vector layer metadata properties for more information.

../../../_images/rasterMetadata.png

图 15.14 Raster Metadata

15.1.9. Legend Properties

The legend Legend tab provides you with a list of widgets you can embed within the layer tree in the Layers panel. The idea is to have a way to quickly access some actions that are often used with the layer (setup transparency, filtering, selection, style or other stuff...).

By default, QGIS provides a transparency widget but this can be extended by plugins that register their own widgets and assign custom actions to layers they manage.

../../../_images/rasterLegend.png

图 15.15 Raster Legend

15.1.10. QGIS Server Properties

From the overlay QGIS Server tab, information can be provided for Description, Attribution, MetadataUrl and LegendUrl.

../../../_images/rasterServer.png

图 15.16 QGIS Server in Raster Properties