Skip to main content
Version: 7.2.0

convex

描述

¥Description

获取一个 特性FeatureCollection 对象并返回其凸包 多边形

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

内部使用实现了 单调链包convex-hull 模块。

¥Internally this uses the convex-hull module that implements a monotone chain hull.

参数

¥Parameters

名称类型描述
geojsonGeoJSON输入要素或要素集合
options?对象可选参数(默认 {})
options.concavity?number1 - 细化形状。无穷大 - 凸包。(默认 Infinity)
options.properties?对象将属性转换为要素(默认 {})

返回

¥Returns

特性<多边形> 凸包

¥Feature<Polygon> a convex hull

示例

¥Examples

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

安装

¥Installation

$ npm install @turf/convex

import { convex } from "@turf/convex";
const result = convex(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.convex(...);