pointList2poly | R Documentation |
Converts a list of points specifying polygons into a spatial object
pointList2poly(points_list, df = NULL, ...)
points_list |
list of data frames of xy coordinates. In each data.frame the last row must be the same as the first row |
df |
data.frame. Optional data.frame to be associated to polygons |
... |
arguments to be passed to |
a simple feature collection with POLYGON geometry.
ellipses4Crown
# Compute coordinates of polygons
ellipses <- ellipses4Crown(c(0, 10), c(0, 10), c(2, 2), c(3, 4), c(2.5, 3), c(2, 3),
id = c("A", "B")
)
# Convert to sf object
ellipses1 <- pointList2poly(ellipses)
ellipses1
# Convert to sf object with user-defined data.frame
ellipses2 <- pointList2poly(ellipses, df = data.frame(info = 1:2))
# draw ellipses
plot(ellipses2, col = ellipses2$info)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.