A very useful technique to work with raster data is changing their values or grouping them into categories. In this recipe, we will see how to do this.
We will classify the elevation in three groups:
To do this, follow these steps:


Values for each cell are compared with the range limits in the lookup table, considering the specified comparison criteria. Whenever a value falls into a given range, the class value specified for this range will be used in the output layer.
Other strategies can be used to automate a reclassification, especially when this involves dividing the raster layer values into classes with some constant property. Here, we show two of these cases.
A typical case of reclassification is dividing the total range of values of the layer into a given number of classes. This is similar to slicing it, and if applied on a DEM, such as our example data, this will have a result similar to that of defining contour lines with a regular interval (although the result is a not vector layer with lines in this case, but a new raster layer).
To reclassify in equal intervals, follow these steps:
The reclassified layer will look like the following:

The numerical values in the formula correspond to the minimum and maximum values of the layer. You can find these values in the properties window of the layer.
To create a different number of classes, just use another value instead of 5 in the formula.
There is no tool to reclassify into a set of n classes, as each of them occupies the same area, but a similar result can be obtained using some other algorithms. To show you how this is done, let's reclassify the DEM into five classes of the same area:
The resulting layer has the cells ordered according to their value in the DEM, so the cell with a value of 1 represents the cell with the lowest elevation value, 2 is the second lowest, and so on.
