- 开始使用
- MEASUREMENT
- COORDINATE MUTATION
- TRANSFORMATION
- FEATURE CONVERSION
- MISC
- HELPER
- RANDOM
- DATA
- INTERPOLATION
- JOINS
- GRIDS
- CLASSIFICATION
- AGGREGATION
- META
- ASSERTIONS
- BOOLEANS
- UNIT CONVERSION
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
coordReduce
Reduce coordinates in any GeoJSON object, similar to Array.reduce()
简化任何GeoJSON对象中的坐标,类似于Array.reduce()
方法
> npm install @turf/meta
参数
参数 | 类型 | 描述 |
---|---|---|
geojson | (FeatureCollection|Geometry|Feature) | 任何 GeoJSON 对象 |
callback | Function | 回调函数 (previousValue, currentCoord, coordIndex) |
initialValue | (*) | 回调函数第一个参数初始值 |
excludeWrapCoord | boolean | whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. |
返回
- The value that results from the reduction.
示例
var features = turf.featureCollection([
turf.point([26, 37], {"foo": "bar"}),
turf.point([36, 53], {"hello": "world"})
]);
turf.coordReduce(features, function (previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
//=previousValue
//=currentCoord
//=coordIndex
//=featureIndex
//=multiFeatureIndex
//=geometryIndex
return currentCoord;
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论