This commit is contained in:
Timon 2026-02-03 14:56:04 +01:00
parent 14300f6832
commit 6efa6b6b05
2 changed files with 10 additions and 2 deletions

View file

@ -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)
}

View file

@ -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
# ***************************