New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@turf/sample

Package Overview
Dependencies
Maintainers
9
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/sample

turf sample module

Source
npmnpm
Version
7.2.0
Version published
Weekly downloads
1.3M
11.36%
Maintainers
9
Weekly downloads
 
Created
Source

@turf/sample

sample

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

Parameters

  • fc FeatureCollection<T>
  • num number number of features to select
  • featurecollection FeatureCollection set of input features

Examples

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

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

//addToMap
var addToMap = [points, sample]
turf.featureEach(sample, function (currentFeature) {
  currentFeature.properties['marker-size'] = 'large';
  currentFeature.properties['marker-color'] = '#000';
});

Returns FeatureCollection a FeatureCollection with n features

This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.

Installation

Install this single module individually:

$ npm install @turf/sample

Or install the all-encompassing @turf/turf module that includes all modules as functions:

$ npm install @turf/turf

Keywords

geojson

FAQs

Package last updated on 29 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts