sample
Description
Takes a FeatureCollection and returns a FeatureCollection with given number of features at random.
Parameters
Name | Type | Description |
---|---|---|
fc | FeatureCollection<T> | |
num | number | number of features to select |
featurecollection | FeatureCollection | set of input features |
Returns
FeatureCollection a FeatureCollection with n
features
Examples
var points = turf.randomPoint(100, { bbox: [-80, 30, -60, 60] });
var sample = turf.sample(points, 5);
Installation
$ npm install @turf/sample
import { sample } from "@turf/sample";
const result = sample(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.sample(...);