/turf-filter

Primary LanguageJavaScriptMIT LicenseMIT

turf-filter

Build Status

Keeps any features from a feature collection that match a property value.

###Install

npm install turf-filter

###Parameters

name description
fc A FeatureCollection
property Property to check
value Value for features to keep

###Usage

filter(fc, property, value)

###Example

var filter = require('turf-filter')
var point = require('turf-point')
var featurecollection = require('turf-featurecollection')

var trees = featurecollection([
	  point(1,2, {species: 'oak'}),
	  point(2,1, {species: 'birch'}),
	  point(3,1, {species: 'oak'}),
	  point(2,2, {species: 'redwood'}),
	  point(2,3, {species: 'maple'}),
	  point(4,2, {species: 'oak'})
  ])

var filtered = filter(trees, 'species', 'oak')
  
console.log(filtered)