randomLineString
描述
¥Description
返回一个随机的 LineString。
¥Returns a random LineString.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
count? | number | 将生成多少个几何体(默认 1) |
options? | 对象 | 可选参数(默认 {}) |
options.bbox? | BBox | 用于放置几何体的边界框。(默认 [-180,-90,180,90]) |
options.num_vertices? | number | 每个 LineString 将包含的坐标数。(默认 10) |
options.max_length? | number | 表示顶点与其前一个顶点之间的最大十进制度数(默认值为 0.0001)。 |
options.max_rotation? | number | 表示线段与前一个线段之间的最大弧度数。(默认 Math.PI/8) |
返回
¥Returns
FeatureCollection<LineString> 线串的 GeoJSON 要素集合
¥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(...);