Skip to content

[Feat] r.slope.aspect: Clockwise from North with flat = 0 and -9999 as NULL  #327

@wenzeslaus

Description

@wenzeslaus

Is your feature request related to a problem? Please describe.

Picking arbitrary combination of CW from North vs CCW from East and flat = -9999 vs flat = 0 is not possible. Additionally -9999 is strange since GRASS GIS is not using this as a special value.

Describe the solution you'd like

The orientation (direction plus reference direction - please suggest better naming if needed) should be selected separately from representation of flag areas in the aspect raster map. For example:

r.slope.aspect orientation=counter-clockwise-east flat=0
r.slope.aspect orientation=clockwise-north flat=-9999
r.slope.aspect orientation=counter-clockwise-east flat=NULL

Besides the greater variability, key=value options are more readable than flags and can be extended by adding, e.g., units=degrees/radians (or modified to split direction and reference direction).

This does not require removing the -n flag, but it is now possible before v8. (Side note: Based on qgis/QGIS/pull/34087, removal of -n will need to be propagated to QGIS.)

Describe alternatives you've considered

Better letter and description for the -n flag, something like "-d Behave like gdaldem (clockwise from North with flat = -9999)."

Additional context

This is continuation of a discussion from #320 by @petrasovaa and @metzm:

BTW, any reason why r.slope.aspect doesn't use nulls instead of 0 or -9999 for aspect of flat areas? Isn't that some legacy behavior or does it have a reason?

The reason is to be compliant with gdaldem which uses -9999 by default as the nodata value.

What is the reason to be compliant with gdaldem in this? Do we use -9999 for nodata anywhere else instead of NULLs? If compatibility with gdaldem is desired or some particular behavior is needed for QGIS that's something we should have, but I think we need to add it systematically. -n now switches both orientation and flat areas.

One way to resolve this would be naming the flag describing what it is: "behave like gdaldem" but we do or did have such parameters here and there and it is just very cryptic for people not knowing gdaldem and this includes the case where you are wondering why CW from N is connected with -9999 for flat. A better way would be to introduce this as two (or three) options giving user flexibility in a general way rather than solving one particular compatibility challenge. Additionally, NULLs should be provided as an additional option since it well represents "I don't know" as the answer to orientation of a flat area.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions