Skip to main content
Version: Next

polygons

描述

¥Description

Creates a 多边形 FeatureCollection from an Array of Polygon coordinates.

¥Creates a Polygon FeatureCollection from an Array of Polygon coordinates.

参数

¥Parameters

名称类型描述
coordinatesUNCERTAIN
properties?GeoJsonPropertiesan Object of key-value pairs to add as properties (default )
options?对象可选参数(默认
options.bbox?BBoxBounding Box Array [west, south, east, north] associated with the Feature
options.id?IDIdentifier associated with the FeatureCollection

返回

¥Returns

FeatureCollection<多边形, GeoJsonProperties> 多边形要素集合

¥FeatureCollection<Polygon, GeoJsonProperties> Polygon FeatureCollection

示例

¥Examples

var polygons = turf.polygons([
[
[
[-5, 52],
[-4, 56],
[-2, 51],
[-7, 54],
[-5, 52],
],
],
[
[
[-15, 42],
[-14, 46],
[-12, 41],
[-17, 44],
[-15, 42],
],
],
]);

//=polygons

安装

¥Installation

$ npm install @turf/helpers

import { polygons } from "@turf/helpers";
const result = polygons(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.polygons(...);