get_alphahull_polygon: Get alpha hull polygon from collection of points

View source: R/spaceout.R

get_alphahull_polygonR Documentation

Get alpha hull polygon from collection of points

Description

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.

Usage

get_alphahull_polygon(pts, tension = 0.5, buffer_size = 0)

Arguments

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

Value

sf GeometryCollection object with a polygon

Examples

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)

nhoteling/spaceheater documentation built on Sept. 24, 2022, 3:04 p.m.