Skip to main content
Version: 7.3.0

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

名称类型描述
geoJsonFeatureCollection | 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(...);