propEach
描述
🌐 Description
迭代任意 GeoJSON 对象中的属性,类似于 Array.forEach()
🌐 Iterate over properties in any GeoJSON object, similar to Array.forEach()
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| geojson | FeatureCollection | Feature | 任何 GeoJSON 对象 |
| callback | propEachCallback | 一个接受 (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(...);