How to find current zoom level in a Google Map?

Viewed 107771

How do I find the current zoom level when loading or clicking a Google map?

4 Answers

Use this code:

float zoomlevel = mMap.getCameraPosition().zoom;

If you need to get zoom on change

google.maps.event.addListener(map, 'zoom_changed', function() {
    var zoom = map.getZoom();
    console.log(zoom);
});

I got it using:

console.log(this.map.zoom);

I'm using agm-angular-google-maps

html:

<agm-map (mapReady)="onMapReady($event)">

TS:

onMapReady(map) {
 this.map = map;
}
Related