| concaveman | R Documentation |
The concaveman function ports the concaveman library from mapbox. It computes the concave polygon for one set of points.
concaveman(points, concavity, length_threshold)
## S3 method for class 'matrix'
concaveman(points, concavity = 2, length_threshold = 0)
## S3 method for class 'sf'
concaveman(points, concavity = 2, length_threshold = 0)
## S3 method for class 'sfc'
concaveman(points, concavity = 2, length_threshold = 0)
points |
the points for which the concave hull must be computed. Can be represented as a matrix of coordinates or an |
concavity |
a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull. You can use values lower than 1, but they can produce pretty crazy shapes. |
length_threshold |
when a segment length is under this threshold, it stops being considered for further detalization. Higher values result in simpler shapes. |
For details regarding the implementation, please see the original javascript library github page. This is just a thin wrapper, via V8.
an object of the same class as points: a matrix of coordinates or an sf object.
data(points)
polygons <- concaveman(points)
plot(points)
plot(polygons, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.