50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

lidaRtRee (version 4.0.8)

pointList2poly: Convert a list of points into spatial polygons object

Description

Converts a list of points specifying polygons into a spatial object

Usage

pointList2poly(points_list, df = NULL, ...)

Value

a simple feature collection with POLYGON geometry.

Arguments

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 st_sfc

See Also

ellipses4Crown

Examples

Run this code
# 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)

Run the code above in your browser using DataLab