After processing a DEM with a mask to get the aspect values of some polygons I would like to create a new field classifying those values as N, NE, E, SE, S, SW, W, NW.
I've written this but I can't get what I'm looking for:
CASE
WHEN "Aspect" < 22.5 THEN 'N'
WHEN (22.5 >= "Aspect" AND "Aspect" < 67.5) THEN 'NE'
WHEN (67.5 >= "Aspect" AND "Aspect" < 112.5) THEN 'E'
WHEN (112.5 >= "Aspect" AND "Aspect" < 157.5) THEN 'SE'
WHEN (157.5 >= "Aspect" AND "Aspect" < 202.5) THEN 'S'
WHEN (202.5 >= "Aspect" AND "Aspect" < 247.5) THEN 'SW'
WHEN (247.5 >= "Aspect" AND "Aspect" < 292.5) THEN 'W'
WHEN (292.5 >= "Aspect" AND "Aspect" < 337.5) THEN 'NW'
WHEN "Aspect" >= 337.5 THEN 'N'
END
Is it possible to do this using CASE-WHEN, or is it better to use another kind of conditional?
I don't know how to write ranges using conditional sentences without getting an error except this way.