Skip to content

KBE3D / KBCore / turf / randomLineString

函数: randomLineString()

randomLineString(count?: number, options?: { bbox?: BBox; num_vertices?: number; max_length?: number; max_rotation?: number; }): FeatureCollection<LineString, any>

Function

Returns a random LineString.

参数

count?

number

how many geometries will be generated

options?

Optional parameters

bbox?

BBox

a bounding box inside of which geometries are placed.

num_vertices?

number

is how many coordinates each LineString will contain.

max_length?

number

is the maximum number of decimal degrees that a vertex can be from its predecessor

max_rotation?

number

is the maximum number of radians that a line segment can turn from the previous segment.

返回

FeatureCollection<LineString, any>

GeoJSON FeatureCollection of linestrings

抛出

if bbox is invalid

示例

ts
var lineStrings = turf.randomLineString(25, {bbox: [-180, -90, 180, 90]})
// => lineStrings

KBE3D @3.0.0 Copyright © 2024-present KBE3D