University information

Combine Slope and Aspect Conditions in a QGIS Raster Mask

In this guide +

A raster mask can look neat while answering an imprecise question. This workshop asks you to translate three stated conditions into a cell-by-cell decision and explain every exclusion. The four cells are fictional. They support Boolean reasoning, not a construction, conservation or land-suitability decision about a real place.

Connect terrain outputs to a declared rule

The QGIS 3.44 terrain-analysis lesson describes deriving slope and aspect from elevation data and combining raster conditions. These outputs describe different terrain properties and should not be treated as interchangeable.

Bring basic familiarity with angles and the words AND and OR. A QGIS installation is optional for the supplied table. No elevation file needs to be downloaded. The central skill is tracing the rule before turning it into a raster expression.

Write the rule without shortcuts

Keep a cell only when its slope is at most ten degrees, its aspect lies from ninety through two hundred seventy degrees inclusive, and its aspect is defined. In this fixture, zero degrees denotes north, ninety east and one hundred eighty south. The flat cell is explicitly assigned an undefined aspect.

Original four-cell fixture
Cell Slope Aspect Interpretation supplied
A 5° 0° North-facing
B 12° 180° South-facing
C 8° 90° East-facing
D 0° Undefined Flat

The undefined value for D is part of this exercise’s data contract. Do not infer how every raster tool encodes flat areas from it. If working with a real output, inspect that tool’s values and missing-data conventions before translating the paper rule.

Work each condition independently

keep = slope_at_most_10
       AND aspect_at_least_90
       AND aspect_at_most_270
       AND aspect_is_defined

A: true  AND false AND true  AND true  → exclude
B: false AND true  AND true  AND true  → exclude
C: true  AND true  AND true  AND true  → keep
D: slope passes; aspect undefined      → exclude

Only C remains. A passes the slope condition but faces outside the interval. B faces within the interval but is too steep for the declared threshold. C passes the inclusive lower aspect boundary. D is excluded because the rule explicitly requires a defined aspect, despite its small slope.

The explanations are as important as the final mask. A result containing only C could be produced accidentally by another expression. The four reasons make the intended logic inspectable and support a useful test when the expression is implemented.

Diagnose an AND-to-OR mistake

Suppose someone keeps a cell when either its slope passes or its aspect is in range. A would then pass by slope and B by aspect. That is a broader selection than the supplied requirement. Fixing the map’s colour scheme would not repair the logical error; the relationship between conditions must change.

For an extension, increase the slope threshold to twelve while keeping every other rule. B and C now pass. The boundary is inclusive, so B’s exact twelve qualifies. A remains outside the aspect interval, and D still lacks a defined aspect. This is a new declared rule, not a correction justified by the original question.

Document the mask for another reader

Provide the threshold, angular convention, missing-value rule and one inclusion or exclusion reason for every cell. If the mask is later generated in software, compare its four outputs with the paper answer before using a larger dataset. Keep the exercise criterion separate from any real policy or scientific interpretation.

The data-dictionary workshop explains why units and missing-value meanings belong beside the data. The behaviour-checking exercise helps turn requirements into observable cases. Continue in the workshop collection.

Questions about raster conditions

Why does the east-facing cell qualify?

The aspect interval includes its lower boundary of ninety degrees, and the cell also passes the slope and defined-value conditions.

Why is the flat cell not automatically accepted?

The declared rule requires a defined aspect. Small slope alone is insufficient for this particular selection.

Does the mask prove that C is suitable for development?

No. It proves only that the fictional cell satisfies the supplied Boolean rule. No real-site evidence or suitability standard is provided.

Official reference

QGIS 3.44: Terrain Analysis, checked 17 October 2026. The cells, thresholds and worked decisions are original.

Related guides

View the worked-example diagram
Only cell C satisfies the slope, aspect and defined-value requirements; the other three each fail a stated condition.
Original explanatory diagram; consult the linked official guidance for current requirements.

Privacy choices

Allow Google Ads measurement cookies and use of ad-click information to attribute visits to our public information pages? This optional measurement stays off until you accept. Separate analytics, personalised advertising and enhanced conversions remain off; we do not configure form-field collection. This new attribution permission is not covered by your earlier choice. You can refuse or change it at any time.

Read our privacy policy