geomEach
Description
Iterate over each geometry 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 (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) |
Returns
- void
Examples
var features = turf.featureCollection([
turf.point([26, 37], { foo: "bar" }),
turf.point([36, 53], { hello: "world" }),
]);
turf.geomEach(
features,
function (
currentGeometry,
featureIndex,
featureProperties,
featureBBox,
featureId,
) {
//=currentGeometry
//=featureIndex
//=featureProperties
//=featureBBox
//=featureId
},
);
Installation
$ npm install @turf/meta
import { geomEach } from "@turf/meta";
const result = geomEach(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.geomEach(...);