powered by
Create a data frame of longitude and latitude centroids of each polygon.
create_centroids(shp_sf, sf_id, largest = TRUE, verbose = FALSE)
a tibble containing longitude and latitude
an sf object, a data set with a simple feature list column
a string to indicate the column to identify individual polygons
logical; for st_centroid: if TRUE, return centroid of the largest subpolygon of a MULTIPOLYGON rather than the whole MULTIPOLYGON
st_centroid
TRUE
MULTIPOLYGON
a boolean to indicate whether to show function progress
centroids <- create_centroids(tas_lga, "lga_code_2016")
Run the code above in your browser using DataLab