featureEach
Description
Iterate over features in any GeoJSON object, similar to Array.forEach.
Parameters
Name | Type | Description |
---|---|---|
geojson | FeatureCollection | Feature | Geometry | any GeoJSON object |
callback | Function | a method that takes (currentFeature, featureIndex) |
Returns
- void
Examples
var features = turf.featureCollection([
turf.point([26, 37], { foo: "bar" }),
turf.point([36, 53], { hello: "world" }),
]);
turf.featureEach(features, function (currentFeature, featureIndex) {
//=currentFeature
//=featureIndex
});
Installation
$ npm install @turf/meta
import { featureEach } from "@turf/meta";
const result = featureEach(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.featureEach(...);