Learn R Programming

sugarbag (version 0.1.3)

create_centroids: Create a data frame of longitude and latitude centroids of each polygon.

Description

Create a data frame of longitude and latitude centroids of each polygon.

Usage

create_centroids(shp_sf, sf_id, largest = TRUE, verbose = FALSE)

Arguments

shp_sf

an sf object, a data set with a simple feature list column

sf_id

a string to indicate the column to identify individual polygons

largest

logical; for st_centroid: if TRUE, return centroid of the largest subpolygon of a MULTIPOLYGON rather than the whole MULTIPOLYGON

verbose

a boolean to indicate whether to show function progress

Value

a tibble containing longitude and latitude

Examples

Run this code
# NOT RUN {
centroids <- create_centroids(tas_lga, "LGA_CODE16")
# }

Run the code above in your browser using DataLab