Skip to main content
Version: 6.5.0

randomLineString

Description

Returns a random LineString.

Parameters

NameTypeDescription
count?numberhow many geometries will be generated (default 1)
options?ObjectOptional parameters (default {})
options.bbox?Array<number>a bounding box inside of which geometries are placed. (default [-180,-90,180,90])
options.num_vertices?numberis how many coordinates each LineString will contain. (default 10)
options.max_length?numberis the maximum number of decimal degrees that a vertex can be from its predecessor (default 0.0001)
options.max_rotation?numberis the maximum number of radians that a line segment can turn from the previous segment. (default Math.PI/8)

Returns

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(...);