Skip to main content
Version: 7.2.0

polygonSmooth

描述

¥Description

平滑 多边形MultiPolygon。基于 Chaikin 算法。警告:可能会创建退化多边形。

¥Smooths a Polygon or MultiPolygon. Based on Chaikin's algorithm. Warning: may create degenerate polygons.

参数

¥Parameters

名称类型描述
inputPolysFeatureCollection<多边形 | MultiPolygon> | 特性<多边形 | MultiPolygon> | 多边形 | MultiPolygon(多个)待平滑的多边形
options?对象可选参数(默认 {})
options.iterations?string多边形的平滑次数。值越高,多边形越平滑。(默认 1)

返回

¥Returns

FeatureCollection<多边形 | MultiPolygon> 包含平滑多边形/多多边形的要素集合

¥FeatureCollection<Polygon | MultiPolygon> FeatureCollection containing the smoothed polygon/multipoylgons

示例

¥Examples

var polygon = turf.polygon([
[
[11, 0],
[22, 4],
[31, 0],
[31, 11],
[21, 15],
[11, 11],
[11, 0],
],
]);

var smoothed = turf.polygonSmooth(polygon, { iterations: 3 });

安装

¥Installation

$ npm install @turf/polygon-smooth

import { polygonSmooth } from "@turf/polygon-smooth";
const result = polygonSmooth(...);
$ npm install @turf/turf

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