Skip to content

Add TPI-based landform classification #950

@brendancol

Description

@brendancol

Reason or Problem

The library computes TPI (Topographic Position Index) but doesn't classify the result into landform categories. Analysts who want to identify ridges, valleys, slopes, plains, etc. have to export TPI values and hand-code the classification logic themselves. The Weiss (2001) method, which thresholds TPI at two scales to produce a 10-class landform map, is the most widely used approach for this and would be straightforward to implement on top of the existing tpi() function.

Proposal

Design:

Add a landforms() function to xrspatial/terrain_metrics.py (where TPI already lives):

  • Compute TPI at two neighborhood scales (small and large)
  • Classify into the Weiss (2001) 10-class scheme: canyons, midslope drainages, upland drainages, U-shaped valleys, plains, open slopes, upper slopes, local ridges, midslope ridges, mountain tops
  • Use slope to discriminate between plains and open slopes
  • Return an integer-coded DataArray with class labels

Since it calls tpi() internally, all four backends work from the start.

Usage:

from xrspatial import landforms

classes = landforms(elevation, inner_radius=3, outer_radius=15)
# Returns integer raster: 1=canyon, 2=midslope drainage, ..., 10=mountain top

Value:

Ecologists, soil scientists, and land managers regularly need landform maps. Right now they have to look up the Weiss thresholds and wire them together with TPI manually. This wraps that into a single call.

Stakeholders and Impacts

Geomorphologists, ecologists, soil scientists, land managers. Builds on existing tpi() and slope() with no changes to those APIs.

Drawbacks

  • The Weiss (2001) scheme assumes roughly normal TPI distributions. Unusual terrain (e.g. flat coastal plains, karst) may need parameter tuning.
  • Some users might expect geomorphons (Jasiewicz & Stepinski 2013) instead of or alongside Weiss.

Alternatives

  • Geomorphons (Jasiewicz & Stepinski 2013): uses ternary line-of-sight profiles rather than TPI. More robust to scale choice, but significantly more complex to implement. Better as a follow-up.
  • Manual TPI thresholding: works, but error-prone and not reproducible without domain knowledge.

Unresolved Questions

  • Whether to include geomorphons in this issue or keep it separate.
  • Default inner/outer radius values. Common choices are 3/15 or 5/25 depending on DEM resolution.
  • Whether the slope threshold for plains vs. open slopes should be configurable or fixed at Weiss's default of 5 degrees.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions