加载或单击谷歌地图时,如何找到当前缩放级别?
If you have a map object like this:
var mapObject = new google.maps.Map(document.getElementById("map"), _mapOptions);
use
mapObject.getZoom();
Use this code:
float zoomlevel = mMap.getCameraPosition().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; }
If you need to get zoom on change
google.maps.event.addListener(map, 'zoom_changed', function() { var zoom = map.getZoom(); console.log(zoom); });