Skip to main content
Version: Next

polygonSmooth

描述

¥Description

Smooths a 多边形 or 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?stringThe number of times to smooth the polygon.A higher value means a smoother polygon.(默认 1)

返回

¥Returns

FeatureCollection<多边形 | MultiPolygon> FeatureCollection containing the smoothed polygon/multipoylgons

¥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(...);