Skip to main content
Version: 7.3.0

propEach

描述

🌐 Description

迭代任意 GeoJSON 对象中的属性,类似于 Array.forEach()

🌐 Iterate over properties in any GeoJSON object, similar to Array.forEach()

参数

🌐 Parameters

名称类型描述
geojsonFeatureCollection | Feature任何 GeoJSON 对象
callbackpropEachCallback一个接受 (currentProperties, featureIndex) 的方法

返回

🌐 Returns

void

示例

🌐 Examples

var features = turf.featureCollection([
turf.point([26, 37], { foo: "bar" }),
turf.point([36, 53], { hello: "world" }),
]);

turf.propEach(features, function (currentProperties, featureIndex) {
//=currentProperties
//=featureIndex
});

安装

🌐 Installation

$ npm install @turf/meta

import { propEach } from "@turf/meta";
const result = propEach(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.propEach(...);