polygonize
描述
🌐 Description
🌐 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:
- 悬挂边:边的一端或两端没有与另一条边的端点相连的边。
- 割边(桥):两端都有连接但不构成多边形一部分的边。
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| geoJson | FeatureCollection | Geometry | Feature<LineString | MultiLineString> | 用于多边形化的线 |
返回
🌐 Returns
FeatureCollection<Polygon> 多边形已创建
安装
🌐 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(...);