I've been trying to make rasters of the area within a certain elevation band of some elevation rasters I have. Simple enough. But when I do the raster calculation, the output is not what it should be (like in a raster with values 1000-2000 if I do "raster">1500 there should be some some areas >1500 that are one color and other areas that are another color, but the resultant raster is one solid block of a single color)
I attached some pictures of what I did and the result to hopefully show the problem better. As you can see, the resultant vector should be a mix of black and white, because some of the original raster is <1525, but it is not
I'm just trying to figure out how to get these kinds of calculations to work
This was my result
nan is from divide by zero, right? Why would this pop up here? I'm not even dividing anything
Best Answer
Although I cannot see the raster value of 3110 maybe due to the min and max values in the raster statistics are not set properly, but anyway you can achieve what you want by applying the following expression:
Please note that the values below or equal to 1525 and above and equal to 3110 will assigned
0
because they don't meet the condition above.Here is an example to extract the values above 800 and below 2000 from the image below:
Using raster calculator, I wrote the following expression:
Here is the output:
You can set the zero value to null using
r.null
tool in GRASS and replace 0 with -9999 asfollows:The final output raster will have values ranges from 801 to 1999 as extracted from raster calculator: