Skip to main content
Version: Next

featureEach

Description

Iterate over features in any GeoJSON object, similar to Array.forEach.

Parameters

NameTypeDescription
geojsonFeatureCollection | Feature | Geometryany GeoJSON object
callbackFunctiona 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(...);