Skip to content

Return removed patches raster from dft_rast_transition() #17

Closed

Description

@NewGraphEnvironment

Problem

When using patch_area_min in dft_rast_transition(), there's no easy way to see what was removed. Users need to visually inspect filtered patches to decide if their threshold is too aggressive or too lenient — especially when ground-truthing against satellite basemaps.

Proposed Solution

Add a $removed element to the return list of dft_rast_transition():

result <- dft_rast_transition(classified, from = "2017", to = "2023",
                              patch_area_min = 5000)

terra::plot(result$raster)   # transitions that survived filtering
terra::plot(result$removed)  # transitions that were cut
  • When patch_area_min = NULL (default): $removed is NULL, no change to current behavior
  • When filtering is active: $removed is a factor SpatRaster with the same levels/colors as $raster, containing only the small patches that were masked
  • Plottable, overlayable, passable to dft_map_interactive()

This lets users iterate on their threshold visually without leaving R.

Relates to #14

Activity

  1. added 2 commits that reference this issue on Apr 1, 2026
    6288a3e
    83f5db3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions