Skip to main content
Version: Next

polygonize

描述

¥Description

(多个)LineString(s) 多边形化为 多边形

¥Polygonizes (Multi)LineString(s) into Polygons.

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:

  • 悬垂线:edges which have one or both ends which are not incident on another edge endpoint.

    ¥Dangles: edges which have one or both ends which are not incident on another edge endpoint.

  • 切边(桥):edges that are connected at both ends but which do not form part of a polygon.

    ¥Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.

参数

¥Parameters

名称类型描述
geoJsonFeatureCollection | 几何图形 | 特性<LineString | MultiLineString>Lines in order to polygonize

返回

¥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(...);