Skip to content

Commit

Permalink
change sf conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoVilela committed Dec 21, 2023
1 parent 8ebad60 commit 836c503
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/defensive_functions.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Defensive codes for letsR functions
.check_shape <- function(shape) {
sf_check <- inherits(shape, "sf")
if (sf_check) {
shape <- st_cast(shape, "MULTIPOLYGON")
}
spatial_check <- inherits(shape, "Spatial")
sp_check <- inherits(shape, "SpatialPolygonsDataFrame")
if (sp_check | spatial_check | sf_check) {
Expand All @@ -17,6 +20,7 @@
return(shape)
}


# Check PAM
.check_pam <- function(x) {
x[[2]] <- terra::unwrap(x[[2]])
Expand Down

0 comments on commit 836c503

Please sign in to comment.