Skip to content

KBE3D / KBCore / turf / coordEach

函数: coordEach()

coordEach(geojson: AllGeoJSON, callback: (currentCoord: number[], coordIndex: number, featureIndex: number, multiFeatureIndex: number, geometryIndex: number) => void, excludeWrapCoord?: boolean): void

Function

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

参数

geojson

AllGeoJSON

any GeoJSON object

callback

(currentCoord: number[], coordIndex: number, featureIndex: number, multiFeatureIndex: number, geometryIndex: number) => void

a method that takes (currentCoord, coordIndex, featureIndex, multiFeatureIndex)

excludeWrapCoord?

boolean

whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.

返回

void

示例

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

turf.coordEach(features, function (currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
  //=currentCoord
  //=coordIndex
  //=featureIndex
  //=multiFeatureIndex
  //=geometryIndex
});

KBE3D @3.0.0 Copyright © 2024-present KBE3D