turf-convex
convex
Takes a set of points and returns a convex hull polygon.
Internally this uses the convex-hull module that implements a monotone chain hull.
Parameters
featurecollection
FeatureCollection<Point> input points
Examples
var points = "type": "FeatureCollection" "features": "type": "Feature" "properties": {} "geometry": "type": "Point" "coordinates": 10195312 43755225 "type": "Feature" "properties": {} "geometry": "type": "Point" "coordinates": 10404052 438424511 "type": "Feature" "properties": {} "geometry": "type": "Point" "coordinates": 10579833 43659924 "type": "Feature" "properties": {} "geometry": "type": "Point" "coordinates": 10360107 43516688 "type": "Feature" "properties": {} "geometry": "type": "Point" "coordinates": 1014038 43588348 "type": "Feature" "properties": {} "geometry": "type": "Point" "coordinates": 10195312 43755225 ; var hull = turf; var resultFeatures = pointsfeatures;var result = "type": "FeatureCollection" "features": resultFeatures; //=result
Returns Feature<Polygon> a convex hull
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Installation
Install this module individually:
$ npm install turf-convex
Or install the Turf module that includes it as a function:
$ npm install turf