JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12319
  • Score
    100M100P100Q94723F
  • License ISC

generate random features

Package Exports

  • turf-random

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (turf-random) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

turf-random

build status

generate random features

turf.random([type='point'], [count=1], options, options.bbox, [options.num_vertices=10], [options.max_radial_length=10])

Generates random GeoJSON data, including Point|Points and Polygon|Polygons, for testing and experimentation.

Parameters

parameter type description
[type='point'] String optional: type of features desired: 'points' or 'polygons'
[count=1] Number optional: how many geometries should be generated.
options Object options relevant to the feature desired. Can include:
options.bbox Array.<number> a bounding box inside of which geometries are placed. In the case of Point features, they are guaranteed to be within this bounds,
while Polygon features have their centroid within the bounds.
[options.num_vertices=10] Number optional: options.vertices the number of vertices added to polygon features.
[options.max_radial_length=10] Number optional: the total number of decimal degrees longitude or latitude that a polygon can extent outwards to
from its center.

Example

var points = turf.random('points', 100, {
  bbox: [-70, 40, -60, 60]
});

//=points

var polygons = turf.random('polygons', 4, {
  bbox: [-70, 40, -60, 60]
});

//=polygons

Returns FeatureCollection, generated random features

Installation

Requires nodejs.

$ npm install turf-random

Tests

$ npm test