Skip to main content
Version: 7.3.0

randomPolygon

描述

🌐 Description

返回一个随机的 多边形

🌐 Returns a random polygon.

参数

🌐 Parameters

名称类型描述
count?数字将生成多少几何体 (默认 1)
options?对象可选参数 (默认 {})
options.bbox?BBox放置几何图形的边界框。(默认 [-180,-90,180,90])
options.num_vertices?数字每条 LineString 将包含多少坐标。(默认 10)
options.max_radial_length?数字是从多边形中心出发,顶点可以延伸的最大十进制度数(纬度或经度)。(默认值 10)

返回

🌐 Returns

FeatureCollection<Polygon> 多边形的 GeoJSON FeatureCollection

示例

🌐 Examples

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

安装

🌐 Installation

$ npm install @turf/random

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

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