javascript - 构建多条路线,从 HERE 地图上的数组中获取端点
问题描述
我正在构建网络应用程序,它应该构建大量路线,并显示它们的距离。所有航线的起始航路点都是恒定的。我试着这样做
function calculateRouteFromAtoB (platform, end) {
var router = platform.getRoutingService(),
routeRequestParams = {
mode: 'fastest;truck;traffic:enabled',
height: '7',
weightPerAxle: '4',
trailersCount: '1',
routeattributes : 'sh,bb,gr',
dirtRoad: '-3',
tollroad:'-3',
//tunnelCategory: 'E',
//maneuverattributes: 'direction,action',
'waypoint0': '50.6431675,29.9479832',
'waypoint1': end
};
router.calculateRoute(
routeRequestParams,
onSuccess,
onError
);
}
var tt;
for(tt=0;tt<array_with_endpoints.length;tt++){
calculateRouteFromAtoB(platform,array_with_endpoints[tt]);
}
功能calculateRouteFromAtoB
将路线添加到地图及其到面板的距离,但问题是面板上的路线长度与实际路线长度不匹配。我认为,端点是随机选择的。如果您知道如何使此代码按顺序选择端点,请告诉我。
解决方案
推荐阅读
- python - 使用 Python 通过流将数据从 S3 传输到 FTP 服务器
- flutter - Flutter sms_autofill 并不总是自动读取 OTP
- node.js - 是否可以在 Cloud Task 中从 Google Cloud Storage 安排 maven jar 文件?
- angular - 在 iis 上发布 Angular 应用程序 - 仅在 iis 端出错
- typescript - 将新值更新到现有接口打字稿
- sql - 为什么 Last_value 需要 frame_clause 才能获得像 First_Value - Window Function PostgreSQL 这样的结果
- reactjs - 使用 React Hooks 更新状态数组对象的最佳方法?
- elasticsearch - Elasticsearch - 使用 n-gram 搜索通配符
- c# - 如何真正使用 HttpRequestMessage 并避免 HttpClient PostAsync 中的错误 500?
- windows - QT 5.12.1 webengineview 中的闪烁问题