# sample

Takes a FeatureCollection and returns a FeatureCollection with given number of features at random.
获取一个FeatureCollection,并随机返回一个具有给定数量FeatureFeatureCollection

> npm install @turf/sample

参数

参数 类型 描述
featurecollection FeatureCollection set of input features
num number number of features to select

返回

FeatureCollection - a FeatureCollection with n features

示例

var points = turf.randomPoint(100, {bbox: [-80, 30, -60, 60]});

var sample = turf.sample(points, 5);
Last Updated: 11/21/2022, 10:43:18 PM