get_alphahull_polygon | R Documentation |
A convenience wrapper around the alphahull::ashape() function. The function creates a polygon around a collection of sf points, given inputs for tension and an optional buffer.
get_alphahull_polygon(pts, tension = 0.5, buffer_size = 0)
pts |
sf points |
tension |
value between 0 and 1, controls how tight polygon should wrap around points; value is fraction of diagonal of bounding box |
buffer_size |
add an optional buffer around points; value in coordinate units |
sf GeometryCollection object with a polygon
data("pdx_breweries") pts <- pdx_breweries$geometry x1 <- get_alphahull_polygon(pts) x2 <- get_alphahull_polygon(pts, tension=0.2, buffer_size=0.1) plot(pts) plot(x1, add=TRUE) plot(x2, add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.