Reclassification of a raster in QGIS 3

Reassignment or reclassification operations consist of the total or partial modification of the values of a raster. Reclassification allows you to group together the current values of a raster.

These operations can be useful in the analysis of the different types of raster, Digital Elevation Models, discrete raster, satellite images.

Examples in raster of continuous variables:

We call continuous raster those that represent a continuous variable in space such as elevation, precipitation, noise, among others, also includes satellite images or product generated.

1. Digital Elevation Model (DEM):

We can use reclassification in a DEM to generate a hypsometry map or in a slope raster to group by ranges.

MED

Reclassify using the GRASS Plugin. Hypsometry:

To know the basic statistics of a Raster you must access to Layer Properties > Histogram or Layer Properties > Information, in the example the height values of the DEM range from 58 to 1635 masl.

QGIS 3 does not have a specific tool to reclassify for it we can use GRASS tools.

Reclasificar con PlugIn GRASS

In the menu Processes activate the Toolbox, then locate GRASS > r.reclass, in the dialog box the MDE is selected, in the text box Reclass Rules we place the expression that defines the intervals:

  • 0 thru 100 = 1
  • 100 thru 200 = 2
  • 200 thru 300 = 3
  • 300 thru 400 = 4
  • 400 thru 600 = 5
  • 600 thru 1000 = 6
  • 1000 thru 1600 = 7
  • 1600 thru 2000 = 8

reclass

The tool runs and generates the output raster, which by default has the name Reclassified. This procedure will facilitate the quantification of the surface of each class and the cartographic representation.

Finally you can alter the text in the Labels and save the style.

reclassified

Reclassify using the Raster Calculator. Slope:

The slope raster in percentage generated from the previous MOU presents values from 0 to 238, a reclassification is applied in ranges that allow a better interpretation of the relief:

  • 0 – 25% Flat to inclined terrain
  • 25 – 50% Corrugated land
  • 50 – 75% Steep terrain
  • 75 – 100% Very steep terrain

raster calculator

To do this, enter the expression in the Raster Calculator:

(“Slope@1″<= 25) * 25 + (“Slope@1” > 25) AND (“Slope@1” <= 50)) * 50 + (“Pending@1”> 50) AND (“Pending@1” <= 75)) * 75 + (“Pending@1” > 75) * 100

Explanation: the * operator assigns a value to the pixels that meet the condition.
As the generated raster has only 4 categories, it is possible to apply one style per Unique Value.

unique value

Generating statistics: to quantify the area occupied by each range of slope select:

Process Toolbox > Raster Analysis > Raster Layer Single Value Report

toolbox

2.- Example in satellite images. Reclassifying raster floating point:

The reclassification of an NDVI can help the process of interpretation of a satellite image, it can also be useful to evaluate the result of a classification.

point flotante

NDVI values are related to the presence or absence of vegetation, low values generally coincide with bare soils or water bodies.

By comparing the NDVI values with the satellite image, the following ranges are defined

  • < 0 water
  • 0 to 0.3 bare soils urban areas
  • 0.3 to 0.65 arable crops
  • 0.65 to 1 dense forest crops

The NDVI values are Float type with 14 decimals, the Raster Calculator has the limitation that it does not make transformations to integers.

Before performing the reclassification, the NDVI is multiplied by a constant, in this case 1000 was used:

Expression: ndvi@1*1000 we call the output Raster ndvi1000

Then select Raster menu > Conversion > Translate (Convert Format), to convert the generated raster to integer.

In the dialog box in Input Layer select ndvi1000, configure the SRC, in Advanced Parameters > Output Data Type select Int32, execute.

SRC

A raster called Converted is generated with values ranging from 0 to 874.

We perform the reclassification by entering the following expression in the Raster Calculator:

(“Converted@1″<= 0) * 1 + ((“Converted@1” > 0) AND (“Converted@1” <= 300)) * 2 + ((“Converted@1”> 300) AND (“Converted@1” <= 650)) * 3 + (“Converted@1” > 650) * 4

Convertido

Finally we configure the style and calculate the statisticsestadistica

Discover more from GIS Crack

Subscribe now to keep reading and get access to the full archive.

Continue reading