3.0.12 • Published 8 years ago

turf-concave v3.0.12

Weekly downloads
11,366
License
ISC
Repository
github
Last release
8 years ago

turf-concave

build status

turf concave module

turf.concave(points, maxEdge, units)

Takes a FeatureCollection of Point features and returns a concave hull.

Internally, this implements a Monotone chain algorithm.

Parameters

parametertypedescription
pointsFeatureCollectiona FeatureCollection of Point features
maxEdgenumberthe size of an edge necessary for part of the hull to become concave (in miles)
unitsStringused for maxEdge distance (miles or kilometers)

Example

var points = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Point",
        "coordinates": [-63.601226, 44.642643]
      }
    }, {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Point",
        "coordinates": [-63.591442, 44.651436]
      }
    }, {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Point",
        "coordinates": [-63.580799, 44.648749]
      }
    }, {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Point",
        "coordinates": [-63.573589, 44.641788]
      }
    }, {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Point",
        "coordinates": [-63.587665, 44.64533]
      }
    }, {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Point",
        "coordinates": [-63.595218, 44.64765]
      }
    }
  ]
};

var hull = turf.concave(points, 1, 'miles');

var resultFeatures = points.features.concat(hull);
var result = {
  "type": "FeatureCollection",
  "features": resultFeatures
};

//=result

Returns Feature, a Polygon feature

Installation

Requires nodejs.

$ npm install turf-concave

Tests

$ npm test
3.0.12

8 years ago

3.0.10

8 years ago

3.0.7

8 years ago

3.0.5

8 years ago

3.0.1

8 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago