Skip to content

KBE3D / KBCore / turf / geomEach

函数: geomEach()

geomEach<G, P>(geojson: GeometryCollection<Geometry> | G | Feature<G, P> | FeatureCollection<G, P> | Feature<GeometryCollection<Geometry>, P>, callback: (currentGeometry: G, featureIndex: number, featureProperties: P, featureBBox: BBox, featureId: Id) => void): void

Function

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

类型参数

G

G extends Geometry | null

P

P extends GeoJsonProperties = GeoJsonProperties

参数

geojson

any GeoJSON object

GeometryCollection<Geometry> | G | Feature<G, P> | FeatureCollection<G, P> | Feature<GeometryCollection<Geometry>, P>

callback

(currentGeometry: G, featureIndex: number, featureProperties: P, featureBBox: BBox, featureId: Id) => void

a method that takes (currentGeometry, featureIndex, featureProperties, featureBBox, featureId)

返回

void

示例

ts
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
});

KBE3D @3.0.0 Copyright © 2024-present KBE3D