1.0.1 • Published 10 years ago

turf-filter v1.0.1

Weekly downloads
1,431
License
MIT
Repository
github
Last release
10 years ago

turf-filter

build status

turf filter module

turf.filter(features, key, value)

Takes a FeatureCollection and filters it by a given property and value

Parameters

parametertypedescription
featuresFeatureCollectioninput FeatureCollection of any type
keyStringthe property on which to filter
valueStringthe value of that property on which to filter

Example

var features = turf.featurecollection([
 turf.point([-72.581777, 44.260875], {species: 'oak'}),
 turf.point([-72.570018, 44.260691], {species: 'birch'}),
 turf.point([-72.576284, 44.257925], {species: 'oak'}),
 turf.point([-72.56916, 44.254605], {species: 'redwood'}),
 turf.point([-72.581691, 44.24858], {species: 'maple'}),
 turf.point([-72.583837, 44.255773], {species: 'oak'})
]);

var key = 'species';
var value = 'oak';

var filtered = turf.filter(features, key, value);

//=features

//=filtered

Installation

Requires nodejs.

$ npm install turf-filter

Tests

$ npm test
1.0.1

10 years ago

1.0.0

10 years ago

0.1.2

10 years ago

0.1.1

11 years ago

0.1.0

11 years ago