带有Bing地图的多个单独的航路点
我希望您的帮助解决问题。在bing地图上,我试图显示多个源和目的地的目的noreferrer“> bing地图。但是它正在彼此连接。我想要每个源和目的地的单独航天点。
在以下代码中,我想在Waypoint 1(Redmond)和2(西雅图)之间绘制单独的线。 Waypoint2(分类单元)与Waypoint3(Orlando)之间也是一个单独的航路点。我想将图像设计为
var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
/* No need to set credentials if already passed in URL */
center: new Microsoft.Maps.Location(47.606209, -122.332071),
zoom: 12
});
Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
// Set Route Mode to driving
directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving });
var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: 'Redmond', location: new Microsoft.Maps.Location(47.67683029174805, -122.1099624633789) });
var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle', location: new Microsoft.Maps.Location(47.59977722167969, -122.33458709716797) });
var waypoint3 = new Microsoft.Maps.Directions.Waypoint({ address: 'TAXAS', location: new Microsoft.Maps.Location(31.000000, -100.000000) });
var waypoint4 = new Microsoft.Maps.Directions.Waypoint({ address: 'Orlando', location: new Microsoft.Maps.Location(28.538336, -81.379234) });
directionsManager.addWaypoint(waypoint1);
directionsManager.addWaypoint(waypoint2);
directionsManager.addWaypoint(waypoint3);
directionsManager.addWaypoint(waypoint4);
// Set the element in which the itinerary will be rendered
directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('printoutPanel') });
directionsManager.calculateDirections();
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单个方向管理器一次只能维护单个路线。如果要显示多个断开的路线,则需要每个路线的单独指示管理器。这里有Bing Maps团队的这种情况的官方样本: htttps:htttps:// samples.bingmapsportal.com/?sample=display-multiple-routes
A single directions manager can only maintain a single route at a time. If you want to show multiple, disconnected routes, you will need a separate directions manager for each route. There is an official sample for this scenario from the Bing Maps team here: https://samples.bingmapsportal.com/?sample=display-multiple-routes