# lineToPolygon

Converts (Multi)LineString(s) to Polygon(s).
将(多)线段转换为多边形。

参数

参数 类型 描述
line (FeatureCollection|Feature <(LineString|MultiLineString)>) Features to convert
options Object 可选参数:见下文

options选项

属性 类型 默认值 描述
properties Object {} translates GeoJSON properties to Feature
autoComplete boolean true auto complete linestrings (matches first & last coordinates)
orderCoords boolean true sorts linestrings to place outer ring at the first position of the coordinates

返回

Feature <(Polygon|MultiPolygon)> - converted to Polygons

示例

var line = turf.lineString([[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]);

var polygon = turf.lineToPolygon(line);
Last Updated: 7/3/2023, 9:59:14 PM