Appearance
KBE3D / KBCore / turf / polygonSmooth
函数: polygonSmooth()
polygonSmooth(
inputPolys:Polygon|MultiPolygon|Feature<Polygon|MultiPolygon,GeoJsonProperties> |FeatureCollection<Polygon|MultiPolygon,GeoJsonProperties>,options?: {iterations?:number; }):FeatureCollection<Polygon|MultiPolygon>
Function
Smooths a Polygon or MultiPolygon. Based on Chaikin's algorithm. Warning: may create degenerate polygons.
参数
inputPolys
(Multi)Polygon(s) to smooth
Polygon | MultiPolygon | Feature<Polygon | MultiPolygon, GeoJsonProperties> | FeatureCollection<Polygon | MultiPolygon, GeoJsonProperties>
options?
Optional parameters
iterations?
number
The number of times to smooth the polygon. A higher value means a smoother polygon.
返回
FeatureCollection<Polygon | MultiPolygon>
FeatureCollection containing the smoothed polygon/multipoylgons
示例
ts
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})
//addToMap
var addToMap = [smoothed, polygon];