Raster selection tools and editing with QGIS expressions.
In the previous version Serval allowed for setting a constant value to a single raster cell at a time. The latest version brings in new raster cells selection tools and new ways of manipulating cells value:
Multi-bands rasters are fully supported - each band can be edited separately. Serval is meant to provide a convenient way to modify selected parts of a raster layer. It is not optimized to process entire images - use Raster Calculator for that.
In order to modify raster cells values users need to select them first with a line or polygon selection tool. The line selection tool has a configurable width and unit. Selections can also be easily imported/exported from/to a vector map layer.
Multiple selections are allowed and users can add or remove from existing selection using CTRL and SHIFT keys modifiers, respectively.
In addition to setting a constant value, new cells value might be evaluated using QGIS expressions.
Users can build their expressions using cells’ row
and column
variables, or x
and y
of cell center point.
In the Serval
group of the builder users will find several expression functions for:
With the recent QGIS additions it is very easy to create mesh layers. Users can use a mesh layer for raster cell value interpolation.
For example, interpolate_from_mesh()
function will identify mesh dataset value and return it as a new raster value, optionally only when the value is higher than existing cell value.
It is a convenient way for finding an embankment shape on a raster DTM - see pictures below.
Another useful function finds the nearest point on a 3D line feature and interpolate its z-value. It could be used for fine-tuning terrain elevation from a 3D profile line.
For example, if the existing embankment crown needs to be raised by an amount at one of its ends, a user could create a profile line, adjust the vertex elevation in the Vertex Editor and use it for the interpolation.
In the Expression builder users can define their own functions using other types of vector and raster layers.
For eliminating peak values or local cell values averaging, users can use 3x3 low-pass filter.
For more details and examples, refer to the plugin’s Manual.