Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

turf-convex

Turfjs51.4kISCdeprecated3.0.12

Turf packages are now namespaced: please use @turf/convex instead

convex

turf, gis

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