To add a listener to detect a zoom change works with the following:
google.maps.event.addListener(map,'zoom_changed',function())
What is the code to detect a change in the map type from ROADMAP
to another view like
SATELLITE
? I can get the value:
val myMapType = map.getMapTypeId();
but do not know how to detect the change in view.
I am using the Google Map API V3.0
Go to the Credentials section, which can be accessed from the left side bar under Google Maps Platform > Credentials. Check that the API key you currently use on your website is listed.
getBounds() in Google Maps API v3 But in API v3 you will get “bounds is undefined” error. So to get our latitude and longitude we need to move getBounds(), to some event listener. Description of bounds_changed in documentation is: “This event is fired when the viewport bounds have changed.”
Latitude + (result. Span. Latitude/2); double swLon = result.
OK worked it out:
google.maps.event.addListener( map, 'maptypeid_changed', function() {
document.getElementById( "maptype" ).value = map.getMapTypeId();
} );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With