2

I have a raster layer with a series of integer values (classes) for each cell. I am trying to use the SAGA Raster Calculator module (called through QGIS) with conditional statements to reclassify each cell based on the cell value itself and the value of a second raster layer which contains a series of decimal values (densities). The following formula is a simpler example of what I'm doing:

ifelse(gt(b,1.6),a+10,a)

What I'm expecting is a series of new integer classes that are either 10 higher than the original if density is greater than 1.6, or the same as the original if not. Instead what I get is numerous intermediate decimal values which seem to be created along the boundaries between cell values as if it is interpolating between them.

Here are some examples of the original raster and the output. You can see the blurring between classes:

Input raster

Result

This is no good to me when I vectorise the result and try to attribute class names to each polygon.

Can someone explain this behavior to me? Both rasters are on exactly the same grid, projections etc. and I have tried messing about with the no data values to no avail. You even get the same problem if you perform a similar operation on two duplicates of the integer class raster suggesting it is not an issue with the second, density layer. However, if you do simple raster algebra without referring to two layers e.g. ifelse(gt(a,4),a+10,a) then the integer classes are preserved and no interpolation occurs.

1 Answer 1

1

I suppose that the smoothing is actually happening due to qgis processing. You can try running the command in SAGA itself. Does your project have the same projection system as the data?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.