- 开始使用
- MEASUREMENT
- COORDINATE MUTATION
- TRANSFORMATION
- FEATURE CONVERSION
- MISC
- HELPER
- RANDOM
- DATA
- INTERPOLATION
- JOINS
- GRIDS
- CLASSIFICATION
- AGGREGATION
- META
- ASSERTIONS
- BOOLEANS
- UNIT CONVERSION
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
计算最短路径
Returns the shortest path from start to end without colliding with any Feature in obstacles
返回从头到尾的最短路径,而不与障碍物中的任何Feature
发生碰撞
参数
参数 | 类型 | 描述 |
---|---|---|
start | Coord | point |
end | Coord | point |
options | Object | 可选参数:见下文 |
options选项
属性 | 类型 | 默认值 | 描述 |
---|---|---|---|
obstacles | Geometry|Feature|FeatureCollection <Polygon>) | areas which path cannot travel | |
minDistance | (number) | minimum distance between shortest path and obstacles | |
units | string | kilometers | unit in which resolution & minimum distance will be expressed in; it can be degrees, radians, miles, kilometers, ... |
resolution | number | 100 | distance between matrix points on which the path will be calculateds |
返回
Feature <LineString> - shortest path between start and end
示例
var start = [-5, -6];
var end = [9, -6];
var options = {
obstacles: turf.polygon([[[0, -7], [5, -7], [5, -3], [0, -3], [0, -7]]]) // 注意:polygon首尾坐标要一致
};
var path = turf.shortestPath(start, end, options);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论