34 lines
1.4 KiB
TypeScript
Executable File
34 lines
1.4 KiB
TypeScript
Executable File
import { Feature, FeatureCollection, MultiPolygon, Point, Polygon, Units } from "@turf/helpers";
|
|
/**
|
|
* Takes a set of {@link Point|points} and returns a concave hull Polygon or MultiPolygon.
|
|
* Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries.
|
|
*
|
|
* @name concave
|
|
* @param {FeatureCollection<Point>} points input points
|
|
* @param {Object} [options={}] Optional parameters
|
|
* @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the
|
|
* hull to become concave.
|
|
* @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers
|
|
* @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull)
|
|
* @example
|
|
* var points = turf.featureCollection([
|
|
* turf.point([-63.601226, 44.642643]),
|
|
* turf.point([-63.591442, 44.651436]),
|
|
* turf.point([-63.580799, 44.648749]),
|
|
* turf.point([-63.573589, 44.641788]),
|
|
* turf.point([-63.587665, 44.64533]),
|
|
* turf.point([-63.595218, 44.64765])
|
|
* ]);
|
|
* var options = {units: 'miles', maxEdge: 1};
|
|
*
|
|
* var hull = turf.concave(points, options);
|
|
*
|
|
* //addToMap
|
|
* var addToMap = [points, hull]
|
|
*/
|
|
declare function concave(points: FeatureCollection<Point>, options?: {
|
|
maxEdge?: number;
|
|
units?: Units;
|
|
}): Feature<Polygon | MultiPolygon> | null;
|
|
export default concave;
|