Skip to content

Commit

Permalink
fix: fix issue with is() usage
Browse files Browse the repository at this point in the history
should fix EPP error @RichDeto
  • Loading branch information
rCarto committed Jan 24, 2022
1 parent 2c24de2 commit 21cd914
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ sfToDf <- function(x){
call. = F)
}
# transform to centroid and to wgs84
if (methods::is(st_geometry(x), c("sfc_GEOMETRY", 'sfc_GEOMETRYCOLLECTION'))){
if (methods::is(st_geometry(x), "sfc_GEOMETRY") ||
methods::is(st_geometry(x), "sfc_GEOMETRYCOLLECTION")){
x <- sf::st_collection_extract(x, "POLYGON", warn = FALSE)
}
if (methods::is(st_geometry(x), c("sfc_POLYGON", "sfc_MULTIPOLYGON"))){
if (methods::is(st_geometry(x), "sfc_POLYGON") ||
methods::is(st_geometry(x), "sfc_MULTIPOLYGON")){
sf::st_geometry(x) <- sf::st_centroid(x = sf::st_geometry(x),
of_largest_polygon = T)
}
Expand Down Expand Up @@ -81,7 +83,8 @@ isopoly <- function(x, breaks,
st_geometry(iso) <- st_make_valid(st_geometry(iso))


if(methods::is(st_geometry(iso),c("sfc_GEOMETRYCOLLECTION", "sfc_GEOMETRY"))){
if(methods::is(st_geometry(iso), "sfc_GEOMETRYCOLLECTION") ||
methods::is(st_geometry(x), "sfc_GEOMETRY")){
st_geometry(iso) <- sf::st_collection_extract(st_geometry(iso), "POLYGON")
}
# get rid of out of breaks polys
Expand Down

0 comments on commit 21cd914

Please sign in to comment.