Skip to content

Commit

Permalink
Merge pull request #40 from inbo/soriadelva-patch-1
Browse files Browse the repository at this point in the history
Add sf:: to necessary commands
  • Loading branch information
SanderDevisscher authored Jul 18, 2024
2 parents c0743c9 + 581e1e2 commit 1e515ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/calculate_polygon_centroid.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ calculate_polygon_centroid <- function(sf_df, id){
}else{
### split the polygons into vertrex points ####
sf_df_sub <- sf_df_sub %>%
st_cast("MULTIPOINT") %>%
st_cast("POINT", do_split = TRUE)
sf::st_cast("MULTIPOINT") %>%
sf::st_cast("POINT", do_split = TRUE)

### Check if the number of points is equal to the number of vertices ####
if(nrow(sf_df_sub) != unique(sf_df_sub$NbrVertex)){
Expand All @@ -129,7 +129,7 @@ calculate_polygon_centroid <- function(sf_df, id){
warning(paste0("no centroid for ", u))
}
### Calculate the distance ####
distance <- st_distance(sf_df_sub, centroids_sub) %>%
distance <- sf::st_distance(sf_df_sub, centroids_sub) %>%
units::drop_units()

### Calculate the maximum distance ####
Expand Down

0 comments on commit 1e515ab

Please sign in to comment.