randomPolygon
Description
Returns a random polygon.
Parameters
| Name | Type | Description |
|---|---|---|
| count? | number | how many geometries will be generated (default 1) |
| options? | Object | Optional parameters (default {}) |
| options.bbox? | BBox | a bounding box inside of which geometries are placed. (default [-180,-90,180,90]) |
| options.num_vertices? | number | is how many coordinates each LineString will contain. (default 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. (default 10) |
Returns
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(...);