3.0.12 • Published 8 years ago
turf-random v3.0.12
turf-random
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 Points and Polygons, for testing and experimentation.
Parameters
parameter | type | description |
---|---|---|
[type='point'] | String | optional: type of features desired. Valid values are 'points' or 'polygons' |
[count=1] | Number | optional: how many geometries should be generated. |
options | Object | relevant to the feature desired. Can include: |
options.bbox | Array. | a bounding box inside of which geometries are placed. In the case of points, they are guaranteed to be within this bounds, |
while polygons have their centroid within it. | ||
[options.num_vertices=10] | Number | optional: 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
Installation
Requires nodejs.
$ npm install turf-random
Tests
$ npm test
3.0.12
8 years ago
3.0.10
8 years ago
3.0.7-canary.ae89c8b3
8 years ago
3.0.1
8 years ago
3.0.0-canary.7879bf6c
8 years ago
3.0.0-canary.2f5f7167
8 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago