Using the V3 Google Maps API, I've run into a case where it seems that creating the map for .setMap() causes .setPanel() to not do anything. The ultimate goal is to have the map load once. If I create the Map prior to the route call, everything works fine. But I first see the map that is loaded when the Map is created, then the .route callback causes the map to load a second time. I want to eliminate that first load or minimize the time gap. Here's the snippet that works:
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsService.route(parms, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setMap(map);
directionsDisplay.setDirections(result);
directionsDisplay.setPanel(document.getElementById("textlist"));
}
});
Here's the broken:
directionsService.route(parms, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setDirections(result);
directionsDisplay.setPanel(document.getElementById("textlist"));
}
});