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
名称 | 类型 | 描述 |
---|---|---|
geojson | GeoJSON | 输入要素或要素集合 |
options? | 对象 | 可选参数(默认 {}) |
options.concavity? | number | 1 - 细化形状。无穷大 - 凸包。(默认 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(...);