From 750737397da7d919292fc8575b3c344d43726efe Mon Sep 17 00:00:00 2001 From: quantifish Date: Mon, 30 Sep 2024 11:11:08 +1300 Subject: [PATCH] added st_make_valid() to QMA and stat area funcs --- R/plot-qma.R | 3 ++- R/plot-statistical-areas.R | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/plot-qma.R b/R/plot-qma.R index 29837c5..2d06531 100644 --- a/R/plot-qma.R +++ b/R/plot-qma.R @@ -84,7 +84,8 @@ get_qma <- function(qma = "CRA", proj = proj_nzsf()) { x <- x %>% st_transform(crs = proj, check = TRUE) %>% st_union(by_feature = TRUE) %>% - st_cast("MULTIPOLYGON") + st_cast("MULTIPOLYGON") %>% + st_make_valid() } return(x) } diff --git a/R/plot-statistical-areas.R b/R/plot-statistical-areas.R index 3bd67d0..c6bfe90 100644 --- a/R/plot-statistical-areas.R +++ b/R/plot-statistical-areas.R @@ -55,7 +55,8 @@ get_statistical_areas <- function(area = "CRA", proj = proj_nzsf()) { x <- x %>% # st_transform(crs = proj, check = TRUE) %>% st_transform(crs = proj) %>% - st_union(by_feature = TRUE) + st_union(by_feature = TRUE) %>% + st_make_valid() # if (!area %in% "EEZ") { # x <- x %>% st_cast("MULTIPOLYGON") # }