Skip to content

Commit db9dfa9

Browse files
Add vector patches and zone attribution to vignette
Demonstrate dft_transition_vectors() with top 10 change patches table and zone attribution using AOI. Remove consensus section (experimental, see #9). Filter same-class transitions from patch table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 54dea3b commit db9dfa9

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

vignettes/land-cover-change.Rmd

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,39 @@ terra::plot(result_filtered$raster, main = paste0("Filtered (min ",
284284
plot(aoi_proj, add = TRUE, border = "red", lwd = 2)
285285
```
286286

287-
## Multi-Year Classification and Transition Overlay
287+
## Vector Patches
288+
289+
`dft_transition_vectors()` converts the transition raster into `sf`
290+
polygons — one row per connected patch. This is the format needed for
291+
GIS QA (click patches, filter by size) and spatial attribution to
292+
management zones.
293+
294+
```{r transition-vectors}
295+
patches <- dft_transition_vectors(result$raster)
296+
297+
# Only actual changes (exclude same-class "transitions")
298+
patches_changed <- patches[grepl("->", patches$transition) &
299+
!sapply(strsplit(patches$transition, " -> "), \(x) x[1] == x[2]), ]
300+
301+
knitr::kable(
302+
head(sf::st_drop_geometry(patches_changed[order(-patches_changed$area_ha), ]), 10),
303+
digits = 2,
304+
caption = "Ten largest change patches (same-class transitions excluded)."
305+
)
306+
```
307+
308+
When `zones` is supplied, each patch is intersected with the zone
309+
polygons. Here we use the floodplain AOI as a single zone — in
310+
practice this would be sub-basins, parcels, or management units.
311+
312+
```{r transition-zones}
313+
aoi$zone <- "Neexdzii Kwa floodplain"
314+
patches_zoned <- dft_transition_vectors(result$raster, zones = aoi,
315+
zone_col = "zone")
316+
cat("Patches inside AOI:", nrow(patches_zoned), "of", nrow(patches), "total\n")
317+
```
318+
319+
## Interactive Map
288320

289321
Toggle between classified time periods and overlay tree loss transition
290322
layers to ground-truth change against multiple satellite basemaps.

0 commit comments

Comments
 (0)