Bing Maps v8 - 如何使用 DirectionsManager 模块设置容差 (tl) 或删除它?
Bing Maps v8 - How to set tolerances (tl) or remove it, using DirectionsManager module?
下面的代码会自动生成一个 URL jsonp 来调用 Bing Maps REST API。但是公差参数是由模块定义的。如何定义要发送的自定义容差?
Tolerance parameter (defined by module): 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 地图 DirectionsManager 文档:
https://msdn.microsoft.com/en-US/library/mt748655.aspx
您无法设置公差,也没有必要设置。默认设置中的最小容差值将 return 路线服务为路线提供的所有坐标。如果有的话,我将看看是否可以将公差值一起删除,因为自从创建方向功能以来,V8 形状的性能已经大大提高。
下面的代码会自动生成一个 URL jsonp 来调用 Bing Maps REST API。但是公差参数是由模块定义的。如何定义要发送的自定义容差?
Tolerance parameter (defined by module): 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 地图 DirectionsManager 文档: https://msdn.microsoft.com/en-US/library/mt748655.aspx
您无法设置公差,也没有必要设置。默认设置中的最小容差值将 return 路线服务为路线提供的所有坐标。如果有的话,我将看看是否可以将公差值一起删除,因为自从创建方向功能以来,V8 形状的性能已经大大提高。