gpt4 book ai didi

javascript - HERE map Javascript API 替代路线

转载 作者:行者123 更新时间:2023-12-02 17:34:22 26 4
gpt4 key购买 nike

最佳答案

nokia.maps.routing.Manager(基于 7.2 路由)不支持替代参数。要将此参数传递给路由,您需要使用 JSONP 调用后端路由服务器:

startRouting = function()
{
var routeUrl = ["http://route.nlp.nokia.com/routing/7.2/calculateroute.json?",
"app_id=" + app_id + "&",
"app_code=" + app_code + "&",
"waypoint0=" + startLat + ","+ startLng + "&",
"waypoint1="+ destLat + "," + destLng + "&",
"instructionformat=text" + "&",
"jsonAttributes=33" + "&",
"mode=fastest;car;traffic:disabled&",
"routeattributes=sh",
"&alternatives=2",
"&jsoncallback=routingcallback"].join("");

script = document.createElement("script");
script.src = routeUrl;
document.body.appendChild(script);
}

var strokeColor = ["#7a24db", "#85db24","#8f0404", "#fdf700"];

routingcallback = function(data)
{
var routes = data.response.route;
for(var i = 0; i < routes.length; i++)
{
var coords = routes[i].shape;

var shape = nokia.maps.geo.Shape.fromLatLngArray(coords, false);

var curColor = strokeColor[i];
if(routes.length == 1)
curColor = strokeColor[3];

var line = new nokia.maps.map.Polyline(shape, { pen: { strokeColor: curColor, lineWidth: 4 } });

display.objects.add(line);
display.zoomTo(line.getBoundingBox(), false, "default");
}
}

关于javascript - HERE map Javascript API 替代路线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22757757/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com