下面的代码会自动生成一个URL jsonp来调用Bing Maps REST API。但公差参数由模块定义。如何定义要发送的自定义容差?
容差参数(由模块定义): tl:4.5263499577364666e-7,0.0000036210799661891733,0.000028968639729513386,0.0002317491178361071,0.0018539929426888567,0.014831943541510854,0.11865554833208683
var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
credentials: 'Your Bing Maps Key',
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) });
directionsManager.addWaypoint(waypoint1);
directionsManager.addWaypoint(waypoint2);
// Set the element in which the itinerary will be rendered
directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('printoutPanel') });
directionsManager.calculateDirections();
});
Bing Maps DirectionsManager文档: https://msdn.microsoft.com/en-US/library/mt748655.aspx
答案 0 :(得分:0)
您无法设置公差,也无需设置公差。默认设置中的最小容差值将返回路由服务为路由提供的所有坐标。如果有的话,我会看看我是否可以将所有公差值一起移除,因为自创建方向功能以来V8形状的性能已大幅提升。