Skip to content

KBE3D / KBCore / turf / propEach

函数: propEach()

propEach<Props>(geojson: Feature<any, GeoJsonProperties> | FeatureCollection<any, GeoJsonProperties> | Feature<GeometryCollection<Geometry>, GeoJsonProperties>, callback: (currentProperties: Props, featureIndex: number) => void): void

Function

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

类型参数

Props

Props extends GeoJsonProperties

参数

geojson

any GeoJSON object

Feature<any, GeoJsonProperties> | FeatureCollection<any, GeoJsonProperties> | Feature<GeometryCollection<Geometry>, GeoJsonProperties>

callback

(currentProperties: Props, featureIndex: number) => void

a method that takes (currentProperties, featureIndex)

返回

void

示例

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

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

KBE3D @3.0.0 Copyright © 2024-present KBE3D