turf sample module


Keywords
geojson, stats, sample, turf
License
MIT
Install
npm install turf-sample@1.0.0

Documentation

turf-sample

build status

turf sample module

turf.sample(features, n)

Takes a FeatureCollection and returns a FeatureCollection with given number of Feature|features at random.

Parameters

parameter type description
features FeatureCollection set of input features
n Number number of features to select

Example

var points = turf.random('points', 1000);

//=points

var sample = turf.sample(points, 10);

//=sample

Returns FeatureCollection, a FeatureCollection with n features

Installation

Requires nodejs.

$ npm install turf-sample

Tests

$ npm test