Manipulating raster data in QGIS

I was encouraged to make this publication as a result of a consultation I had. Sometimes when we work with raster data, we need to modify some of its values, although we can perform processes such as reclassifications.

Sometimes we just need to change the value of a particular pixel, or a group of nearby pixels or a specific area. For the above we now have the QGIS plugin available for the latest versions called Serval.

Step 1: Install the plugin

In Manage and Install Pluging look for Serval plugin.

Step 2: Load our raster layers

It is important to note that the modifications made will be saved, therefore, the first recommendation is to keep a copy of our original raster. Now we just need to identify the plugin in our toolbar. For this example we will use a DEM of a basin in Peru.

Step 3: Working in Probing mode

The first option we have is the edition of pixel values individually, for this we must activate the “Probing” mode, then we go inside our raster to the pixel we want to modify, the existing values of the cell appear in the bar, we simply modify it and give Enter to save.

Step 4: Working under Drawing mode

The “Drawing” mode allows us to choose the value of the cell or of its values (if it is multiband), with the purpose of modifying them in each point that we draw, the selected value will be repeated wherever we go.

For the case where there are three bands, three values will appear in the boxes, if this is the case, we also have the possibility of selecting a specific color.

Step 5: Working under “Erasing” mode

By activating this tool (very carefully), we are assigning a “NoData” value to our selected cells. To verify that this value is assigned, we can resort to an additional plugin, in this case I always recommend the “Value Tool”.

Final Considerations:

We must realize that this tool works with the properties of the layer, if we go to the “Transparency” part, we will see that it has defined a value to be assigned as “No data”, with the option to also define an additional value to be considered as “No data”.

The assignment can be done from the properties of the raster as well as from the panel of the plugin.

For the case of our example, the DEM had outside its borders values of -32768, therefore, it was indicated that it should be considered as values for “No data”.

If we want to check, try using the “Probing” mode on the area you assigned as “NoData”, the value considered will appear in a box of the panel.

he properties of the raster as well as from the panel of the plugin. For the case of our example, the DEM had outside its borders values of -32768, therefore, it was indicated that it should be considered as values for “No data”. If we want to check, try using the “Probing” mode on the area you assigned as “NoData”, the value considered will appear in a box of the panel.

Finally I can mention that there is the option to undo and redo, but only for the active layer. There is also a help button that directs them to the plugin repository (https://github.com/erpas/serval/wiki).

Translate from: carbajallosa

Discover more from GIS Crack

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

Continue reading