diff --git a/r_app/10_create_per_field_tiffs.R b/r_app/10_create_per_field_tiffs.R index 56fd5f9..5d88573 100644 --- a/r_app/10_create_per_field_tiffs.R +++ b/r_app/10_create_per_field_tiffs.R @@ -79,6 +79,14 @@ load_field_boundaries <- function(geojson_path) { } } + # FIX: Validate and repair geometries (handles duplicate vertices, degenerate edges, etc) + invalid_count <- sum(!st_is_valid(fields)) + if (invalid_count > 0) { + smartcane_log(paste("WARNING: Found", invalid_count, "invalid geometry/geometries - attempting repair")) + fields <- st_make_valid(fields) + smartcane_log(paste("Repaired invalid geometries using st_make_valid()")) + } + smartcane_log(paste("Loaded", nrow(fields), "field(s)")) return(fields) } diff --git a/r_app/run_full_pipeline.R b/r_app/run_full_pipeline.R index 4a06d14..d3d1e33 100644 --- a/r_app/run_full_pipeline.R +++ b/r_app/run_full_pipeline.R @@ -30,8 +30,8 @@ # ============================================================================== # *** EDIT THESE VARIABLES *** -end_date <- as.Date("2026-01-07") # or specify: as.Date("2026-01-27") , Sys.Date() -project_dir <- "aura" # project name: "esa", "aura", "angata", "chemba" +end_date <- Sys.Date() # or specify: as.Date("2026-01-27") , Sys.Date() +project_dir <- "angata" # project name: "esa", "aura", "angata", "chemba" data_source <- "merged_tif" # Standard data source directory force_rerun <- FALSE # Set to TRUE to force all scripts to run even if outputs exist # ***************************