All,
When I use the Directions-service from Google Maps, it seems like the map always goes to zoom level 0 (I get an overview of the whole map).
When I set the code for the directions in comment, the zoom level is working well.
This is my code:
/**
* Update route
*/
updateRoute: function ()
{
// route
var start = "Belgium";
var end = "France";
var request =
{
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
var directionsDisplay = new google.maps.DirectionsRenderer();
var directionsService = new google.maps.DirectionsService();
directionsDisplay.setMap(this.items.items[0].map);
directionsSer开发者_Python百科vice.route(request, function(response, status)
{
if (status == google.maps.DirectionsStatus.OK)
{
directionsDisplay.setDirections(response);
}
});
}
This is what I get:
Hopefully someone can help me with this?
Thanks in advance!
The map automatically zooms out to the range required to display the entire route.... I tried ur code.... If you select the start and origin as two places closer (preferably the same area/city) then the zoom level goes down to like 15-16 depending on the distance....
Since you've basically selected Belgium and France (both of which are really broad areas and not a single map point (so to speak) the zoom level goes down to 1 :)
Hope this helps
精彩评论