Type: | Package |
Title: | A Very Fast 2D Concave Hull Algorithm |
Version: | 1.1.0 |
Description: | The concaveman function ports the 'concaveman' (https://github.com/mapbox/concaveman) library from 'mapbox'. It computes the concave polygon(s) for one or several set of points. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
Imports: | V8, sf, magrittr, jsonlite, dplyr |
RoxygenNote: | 7.1.0 |
Suggests: | testthat |
URL: | https://joelgombin.github.io/concaveman/, http://www.github.com/joelgombin/concaveman/ |
BugReports: | http://www.github.com/joelgombin/concaveman/issues |
SystemRequirements: | GDAL (>= 2.0.0), GEOS (>= 3.3.0), PROJ.4 (>= 4.8.0) |
NeedsCompilation: | no |
Packaged: | 2020-05-10 21:54:54 UTC; joel |
Author: | Joël Gombin [cre, aut], Ramnath Vaidyanathan [aut], Vladimir Agafonkin [aut], Mapbox [cph] |
Maintainer: | Joël Gombin <joel.gombin@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2020-05-11 10:50:07 UTC |
concaveman: A very fast 2D concave hull algorithm.
Description
This package is a simple R port (through V8
) of a JavaScript library by Vladimir Agafonkin.
The concaveman
function ports the concaveman library from mapbox. It computes the concave polygon for one set of points.
Usage
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)
Arguments
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. |
Details
For details regarding the implementation, please see the original javascript library github page. This is just a thin wrapper, via V8
.
Value
an object of the same class as points
: a matrix of coordinates or an sf
object.
Examples
data(points)
polygons <- concaveman(points)
plot(points)
plot(polygons, add = TRUE)
Fixtures data
Description
This is just a test dataset which comes from the original mapbox library.
Usage
points
Format
an sf
object with a 1000 points. Each of them is part of a group, indicated by variable k (generated by a k-means algorithm).
Source
https://github.com/mapbox/concaveman/blob/master/test/fixtures/points-1k.json