我正在尝试为48个航点提供方向,但谷歌只允许每个请求渲染8个航点.所以我做了多个请求(在我的情况下是6).但是,API以某种方式为最后一个请求执行了fitBounds().
如何使用fitBounds()和/或setZoom()在一个地图中显示所有48个航路点
我的代码如下: -
function DisplayDirection(directionList){
var interval = 8; // upper bound for usage limits in google directions API is 8
var startIndex =0;
var maxmimumIndex = directionList.length-1; // Total number of waypoints in this route
var partialEndIndex = interval-1; // end waypoint at start
var iteration = 0; // loop controler
directionsService = new google.maps.DirectionsService();
var resultSet = new Array();
var directionsDisplayList = new Array();
var resultsCached = 0;
var bounds = new google.maps.LatLngBounds();
do { //do...while to …Run Code Online (Sandbox Code Playgroud)