Mastering Geospatial Development with QGIS 3.x
上QQ阅读APP看书,第一时间看更新

Raster resampling

Raster resampling prepares the raster for display when not every raster cell can be mapped to its own pixel on the display. If each raster cell is mapped to its own display pixel, the raster renders at full resolution (also known as 1:1). However, since screen sizes are limited and we may wish to enlarge or reduce the size of the raster as we work at different map scales, the raster cells must be mapped to more than one pixel or a number of raster cells must be combined, or dropped, to map to a single pixel. As some raster cells cannot be shown at different resolutions, QGIS must determine how to render the raster and still maintain the character of the full-resolution raster. This section will discuss the parameters that are available for determining how the raster will be resampled for display.

The Resampling section of the raster Style tab has three parameters: Zoomed: in, Zoomed: out, and Oversampling.

The Resampling section with its default parameters is shown in the following screenshot:

Let's have a look at these parameters:

  • Zoomed: in parameter sets the resampling method when zoomed in on the raster. Three resampling methods are available for selection: Nearest neighbour, Bilinear, and Cubic.
  • Zoomed: out parameter sets the resampling method when zoomed out from the raster. Two resampling methods are available for selection: Nearest neighbour and Average.
  • Oversampling parameter determines how many subpixels will be used to compute the value when zoomed out.

The four resampling methods that can be selected for use are as follows:

  • Nearest neighbour: In this method, each raster cell is assigned the value of the nearest cell (measure between cell centers). This is a great method to choose when the raster represents discrete, categorical data as no new values are created.
  • Bilinear: In this method, each raster cell is assigned an average value based on the four closest cells with original values. This method will smooth the data and may flatten peaks and fill valleys.
  • Average: In this method, each raster cell is assigned an average value based on surrounding cells with original values. This method will smooth the data and may flatten peaks and fill valleys.
  • Cubic: In this method, each raster cell is assigned an interpolated value based on the surrounding cells with original values. Unlike the bilinear method, this method will not smooth the peaks or valleys as much, and it tends to maintain local averages and variability. This is the most computationally intensive method.