View source: R/spatial_manipulation.R
add_area | R Documentation |
This function takes a polygon or multipolygon sf object and calculates and adds area fields to the data frame. It will always add square meters, but may additionally add square kilometers and hectares as well.
add_area(polygons, area_ha = TRUE, area_sqkm = TRUE, byid = TRUE)
polygons |
Polygon or multipolygon sf object. These are the polygons to add the area variables to. Areas will be added to each observation in the attributes, so make sure that polygons are "dissolved" by their identities before calculating areas. |
area_ha |
Logical. If |
area_sqkm |
Logical. If |
The original sf object with an additional field for each area unit calculated, always with at least "area_sqm"
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.