Skip to main content
Version: 6.5.0

polygonSmooth

Description

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

Parameters

NameTypeDescription
inputPolysFeatureCollection | Feature<Polygon | MultiPolygon>(Multi)Polygon(s) to smooth
options?ObjectOptional parameters (default {})
options.iterations?stringTHe number of times to smooth the polygon. A higher value means a smoother polygon. (default 1)

Returns

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