如何在 bing 地图中根据 json 捕捉到 bing 道路 api 的响应绘制路线

How to draw route in bing map from json response of snap to road api of bing

Bing 对齐道路 api - https://docs.microsoft.com/en-us/bingmaps/rest-services/routes/snap-points-to-roads

如何在 bing 地图上投影响应?

您必须将点数组转换为 Location 对象数组,然后将其传递给多段线以将其在地图上呈现为线。例如:

var coords = [];

response.points.forEach(p => {
    coords.push(new Microsoft.Maps.Location(p.latitude, p.longitude));
});

//Create a polyline
var line = new Microsoft.Maps.Polyline(coords, {
    strokeColor: 'red'
});

//Add the polyline to map
map.entities.push(line);