randomLineString
Description
Returns a random LineString.
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_length? | number | is the maximum number of decimal degrees that a vertex can be from its predecessor (default 0.0001) |
options.max_rotation? | number | is the maximum number of radians that a line segment can turn from the previous segment. (default Math.PI/8) |
Returns
FeatureCollection<LineString> GeoJSON FeatureCollection of linestrings
Examples
var lineStrings = turf.randomLineString(25, { bbox: [-180, -90, 180, 90] });
// => lineStrings
Installation
$ npm install @turf/random
import { randomLineString } from "@turf/random";
const result = randomLineString(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.randomLineString(...);