javascript - fitBounds and getZoom not playing nice -


i have following code running after map 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 not successful following reason: " + status);       }     });   } 

the problem tha zoom check , set doesn't work. have checked , map initiated map.getzoom() function returns undefinted @ time.

is there can force wait until fitbounds have been set , zoom level known can control zoom appropriately?

  // define bounds changed event handler "once-only" zoom level check   google.maps.event.addlistener(map, 'bounds_changed', function() {     initialzoomcheck()   });  geocoder.geocode( { 'address': address}, function(results, status) {   if (status == google.maps.geocoderstatus.ok) {     map.fitbounds(results[0].geometry.bounds);     function initialzoomcheck() {    // re-define event handler routine called once   google.maps.event.addlistener(map, 'bounds_changed', function() {     document.posicion.z.value=map.getzoom()   });    if (map.getzoom() > 12) {     map.setzoom (12);   } } 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

sql server - python to mssql encoding problem -

windows - Python Service Installation - "Could not find PythonClass entry" -