randomPolygon
描述
¥Description
返回一个随机的 polygon。
¥Returns a random polygon.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
count? | number | how many geometries will be generated (default 1) |
options? | 对象 | 可选参数(默认 ) |
options.bbox? | BBox | a bounding box inside of which geometries are placed.(默认 [-180,-90,180,90]) |
options.num_vertices? | number | is how many coordinates each LineString will contain.(默认 10) |
options.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.(默认 10) |
返回
¥Returns
FeatureCollection<多边形> GeoJSON FeatureCollection of polygons
¥FeatureCollection<Polygon> GeoJSON FeatureCollection of polygons
示例
¥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(...);