turf-convex

# convex

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
turf-convex
3.0.127 years ago10 years agoMinified + gzip package size for turf-convex in KB

Readme

turf-convex
build status

turf.convex(input)

Takes any GeoJSON object and returns a convex hull polygon.
Internally this implements a Monotone chain algorithm.

Parameters

| parameter | type | description | | --------- | ------- | ------------------ | | input | GeoJSON | any GeoJSON object |

Example

var points = turf.featurecollection([
  turf.point([10.195312, 43.755225]),
  turf.point([10.404052, 43.8424511]),
  turf.point([10.579833, 43.659924]),
  turf.point([10.360107, 43.516688]),
  turf.point([10.14038, 43.588348]),
  turf.point([10.195312, 43.755225])]);

var hull = turf.convex(points);

var result = turf.featurecollection(
  points.features.concat(hull));

//=result

Returns Feature, a Polygon feature

Installation

Requires nodejs.
$ npm install turf-convex

Tests

$ npm test