polygonize
描述
¥Description
将 (多个)LineString(s) 多边形化为 多边形。
¥Polygonizes (Multi)LineString(s) into Polygons.
GEOSPolygonize 函数 (geos::operation::polygonize::Polygonizer
) 的实现。
¥Implementation of GEOSPolygonize function (geos::operation::polygonize::Polygonizer
).
将表示平面图中边的一组线多边形化。边必须正确节点化,即它们只能在其端点相交。
¥Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly noded, i.e., they must only meet at their endpoints.
实现正确处理:
¥The implementation correctly handles:
-
悬垂线:一端或两端不与另一端点重合的边。
¥Dangles: edges which have one or both ends which are not incident on another edge endpoint.
-
切边(桥):两端相连但不构成多边形的边。
¥Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geoJson | FeatureCollection | 几何图形 | 特性<LineString | MultiLineString> | 多边形化所需的线段 |
返回
¥Returns
FeatureCollection<多边形> 创建的多边形
¥FeatureCollection<Polygon> Polygons created
安装
¥Installation
$ npm install @turf/polygonize
import { polygonize } from "@turf/polygonize";
const result = polygonize(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.polygonize(...);