convex
描述
🌐 Description
接受一个 Feature 或一个 FeatureCollection 并返回一个凸包 Polygon。
🌐 Takes a Feature or a FeatureCollection and returns a convex hull Polygon.
内部使用了 convex-hull 模块,该模块实现了 monotone chain hull。
🌐 Internally this uses the convex-hull module that implements a monotone chain hull.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| geojson | GeoJSON | 输入要素或要素集合 |
| options? | Object | 可选参数 (默认 {}) |
| options.concavity? | number | 1 - 瘦形状。Infinity - 凸包。(默认 Infinity) |
| options.properties? | Object | 将属性转换为功能 (默认 {}) |
返回
🌐 Returns
示例
🌐 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(...);