Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

turf-sample

Turfjs73.9kMITdeprecated3.0.12

Turf packages are now namespaced: please use @turf/sample instead

turf sample module

geojson, stats, sample, turf

readme

turf-sample

build status

turf sample module

turf.sample(features, n)

Selects a given number of Feature|features from a FeatureCollection at random.

Parameters

parameter type description
features FeatureCollection
n number number of features to select

Example

// create a lot of points
var points = turf.random('points', 1000);
//=points

// sample just a few of them
var sample = turf.sample(points, 10);
//=sample

Installation

Requires nodejs.

$ npm install turf-sample

Tests

$ npm test