0

I´m playing around with the Raster tools in QGIS, following more or less the qgis-tutorial but using my own data. When I calculate the aspect of a DEM, flat areas are (logically) left without data. However, when I try to make an addition with another rather afterwards in the raster calculator, the flat areas (no data in my aspect layer) are never taken into consideration, even if the raster I use for addition has data in this area.

For example: Let´s say I´m looking for places facing south (135-225°) with slopes less than 15%. To find these places I have two rasters:

  • Raster A: aspect 135-225° has the value 1, the rest 0 and flat areas without aspect have no data (the appear transparent)
  • Raster B: slopes less 15% have the value 1, the rest 0

If I combine the two rasters in the Raster Calculator (e.g. like this: "ANP_aspect_sur@1" = 1 AND "ANP_slope_15@1" = 1), the output file has no data where Raster A has no data, independent of Raster B.

What am I doing wrong?

I thought about setting flat areas to 0 (-zero_for_flat). But in this case 0 would stand both for north in regards of the aspect and for nodata.

As far as I know ArcMap assigns -1 to flat areas.

4
  • 1
    It's not clear what problem you are working around. Could you explain what sense it would make to add an undefined aspect to any other value?
    – whuber
    Jul 10, 2014 at 21:02
  • OK, for example: Let´s say I´m looking for places facing south (135-225°) with slopes less than 15%. To find these places I have two rasters: Raster A: aspect 135-225° has the value 1, the rest 0 and flat areas without aspect have no data (the appear transparent) Raster B: slopes less 15% have the value 1, the rest 0 If I combine the two rasters in the Raster Calculator (e.g. like this: "ANP_aspect_sur@1" = 1 AND "ANP_slope_15@1" = 1), the output file has no data where Raster A has no data, independent of Raster B. Tricky to explain …
    – Flo
    Jul 10, 2014 at 21:23
  • Thank you. I think I follow: you wish to treat zero-slope areas as having all aspects and that can be quite a reasonable thing to do. This is usually handled in aspect calculations by assigning a special code to such areas (such as -1) rather than NoData, which confounds them with actual missing data. But you can easily put such a code back in if you wish, simply by referring to the zeros in the slope grid. Is my interpretation correct? If so, it would help future readers if you were to edit your post to make this point a little clearer.
    – whuber
    Jul 10, 2014 at 22:14
  • Thank you too! In this case my question would be: how can I assign e.g. -1 to the nodata areas. Is this done when I calculate the aspect or afterwards?
    – Flo
    Jul 11, 2014 at 14:57

2 Answers 2

2

You might take a look at the GRASS model r.param.scale. This module is designed to create a categorical raster of geo-morphology. You choose the threshold slope and it creates all "flat" areas with value 0. Then you could easily concoct an r.mapcalc expression to extract areas where the aspect is south and the terrain (output of r.param.scale) = '0'

-1

The only way I´ve found to solve the issue is to calculate the aspect via GRASS using r.aspect.

GRASS uses 1-360° and 0° exclusively for flat areas.

3
  • This not only is bizarre (because it would exclude valid aspects of 0 degrees), but it conflicts with the GRASS manual which states "The aspect is not defined for slope equal to zero."
    – whuber
    Mar 12, 2015 at 16:18
  • Hmmm - that´s interesting, in QGIS the r.aspect help states: "The aspect value 0 is used to indicate undefined aspect in flat areas with slope=0." A value of 0 assigned to flat areas is what I needed.
    – Flo
    Mar 12, 2015 at 19:09
  • I see how that could be misread. This convention maintains a distinction between an aspect of 0 in a non-flat area and an aspect of 0 in a flat area: they can be distinguished by looking at the slope, as the quotation states. Thus, it would be an error to interpret all aspects of 0 as indicating flat areas, which is what your answer could be read as saying.
    – whuber
    Mar 12, 2015 at 20:49

Your Answer

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

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