Skip to content

KBE3D / KBCore / turf / randomPolygon

函数: randomPolygon()

randomPolygon(count?: number, options?: { bbox?: BBox; num_vertices?: number; max_radial_length?: number; }): FeatureCollection<Polygon, any>

Function

Returns a random polygon.

参数

count?

number

how many geometries will be generated

options?

Optional parameters

bbox?

BBox

a bounding box inside of which geometries are placed.

num_vertices?

number

is how many coordinates each LineString will contain.

max_radial_length?

number

is the maximum number of decimal degrees latitude or longitude that a vertex can reach out of the center of the Polygon.

返回

FeatureCollection<Polygon, any>

GeoJSON FeatureCollection of polygons

抛出

if bbox is invalid

示例

ts
var polygons = turf.randomPolygon(25, {bbox: [-180, -90, 180, 90]})
// => polygons

KBE3D @3.0.0 Copyright © 2024-present KBE3D