Skip to content

KBE3D / KBCore / turf / convex

函数: convex()

convex<P>(geojson: AllGeoJSON, options?: { concavity?: number; properties?: P; }): Feature<Polygon, P> | null

Function

Takes a Feature or a FeatureCollection and returns a convex hull Polygon.

Internally this uses the convex-hull

module that implements a monotone chain hull.

类型参数

P

P extends GeoJsonProperties = GeoJsonProperties

参数

geojson

AllGeoJSON

input Feature or FeatureCollection

options?

Optional parameters

concavity?

number

1 - thin shape. Infinity - convex hull.

properties?

P

Translate Properties to Feature

返回

Feature<Polygon, P> | null

a convex hull

示例

ts
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);

//addToMap
var addToMap = [points, hull]

KBE3D @3.0.0 Copyright © 2024-present KBE3D