| polygon_area_cumulative | R Documentation |
Compute the area and perimeter of a polygon at each vertex, showing how the measurements accumulate as vertices are added.
polygon_area_cumulative(x, polyline = FALSE)
x |
A two-column matrix or data frame of coordinates (longitude, latitude) in decimal degrees defining polygon vertices, or a list with longitude and latitude components. |
polyline |
Logical. If FALSE (default), compute area and perimeter of a closed polygon. If TRUE, compute only the length of a polyline (area will be meaningless). |
This function is useful for understanding how polygon area accumulates and for debugging polygon vertex order issues.
A data frame with columns:
lon: Longitude of vertex
lat: Latitude of vertex
area: Cumulative area in square meters up to this vertex
perimeter: Cumulative perimeter in meters up to this vertex
# Watch area accumulate as vertices are added
pts <- cbind(
lon = c(0, -74, -43, 28),
lat = c(52, 41, -23, -26)
)
polygon_area_cumulative(pts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.