I have the following code which I am running almost immediately after map is initialised
function showAddress(address) {
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.fitBounds(results[0].geometry.bounds);
if (map.getZoom() < 12) {
map.setZoom(12);
}
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
The problem is tha the zoom check and set doesn't work. I have checked and the map is initiated but the map.getZoom() function returns undefinted at this time.
Is there anything I can do to force it to wait until the fitbounds have been set and the zoom level is known so I can control the zoom appropriately?