iOS: How to know zoom level of GMSMapView - ios

Hello I want to get current zoom level of Google Map view, like in a condition to check.
For example,
if(mapView.zoom==18.0)
{
//code goes here..
}
How to get that ?

It's pretty easy. GMSMapView has a camera (GMSCameraPosition) property that has a zoom property.
CGFloat zoom = mapView.camera.zoom;
Note that zoom property is readonly.

You can use below code.
#define MERCATOR_RADIUS 85445659.44705395
#define MAX_GOOGLE_LEVELS 20
#interface MKMapView (ZoomLevel)
- (double)getZoomLevel;
#end
#implementation MKMapView (ZoomLevel)
- (double)getZoomLevel
{
CLLocationDegrees longitudeDelta = self.region.span.longitudeDelta;
CGFloat mapWidthInPixels = self.bounds.size.width;
double zoomScale = longitudeDelta * MERCATOR_RADIUS * M_PI / (180.0 * mapWidthInPixels);
double zoomer = MAX_GOOGLE_LEVELS - log2( zoomScale );
if ( zoomer < 0 ) zoomer = 0;
// zoomer = round(zoomer);
return zoomer;
}
#end
Also can use MKCoordinateSpan check document for more information.
typedef struct {
CLLocationDegrees latitudeDelta;
CLLocationDegrees longitudeDelta;
} MKCoordinateSpan;

Related

Detect zoom on GMSMapView (iOS)

How can I find if the user zoomed in/out on my mapView (GMSMapView)?
I want to do that if the zoom is bigger than 14 all the markers on the map will disappear and if it's smaller all the markers will reload.
How can I do that?
Thanks!
The below code assumes that the view controller has a property of "markerArray" which holds all of the markers.
-(void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition*)position {
int zoom= mapView.camera.zoom;
if (zoom < 14) {
[mapView_ clear];
}
else{
[self displayAllMarkers];
}
}
-(void) displayAllMarkers{
for (BarObject *barMarker in markerArray){
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = barMarker.location; //
marker.icon = [GMSMarker markerImageWithColor:[UIColor blackColor]];
marker.map = mapView_;
}
}
I also searched for this answer over the summer, and here is what I found and ended up doing:
Create a category on MKMapView:
I named it MKMapView+ZoomLevel
.h
// MKMapView+ZoomLevel.h
#import <MapKit/MapKit.h>
#interface MKMapView (ZoomLevel)
- (int)currentZoomLevel;
#end
.m
// MKMapView+ZoomLevel.m
#import "MKMapView+ZoomLevel.h"
#define MERCATOR_OFFSET 268435456
#define MERCATOR_RADIUS 85445659.44705395
#define MAX_GOOGLE_LEVELS 20
#implementation MKMapView (ZoomLevel)
- (int)currentZoomLevel
{
CLLocationDegrees longitudeDelta = self.region.span.longitudeDelta;
CGFloat mapWidthInPixels = self.bounds.size.width*2;//2 is for retina display
double zoomScale = longitudeDelta * MERCATOR_RADIUS * M_PI / (180.0 * mapWidthInPixels);
double zoomer = MAX_GOOGLE_LEVELS - log2( zoomScale );
if ( zoomer < 0 ) zoomer = 0;
zoomer = round(zoomer);
return (int)zoomer;
}
#end
Then in your view controller:
#import "MKMapView+ZoomLevel.h
// insert logic here
double zoomLevel = [self.mapView currentZoomLevel];
if (zoomLevel > 14 ) {
// add code to hide or resize your annotations
for (id<MKAnnotation> annotation in self.mapView.annotations) {
if (![annotation isKindOfClass:[MKUserLocation class]]) {
[self.mapView removeAnnotation:annotation];
}
}
}

MKMapView - How to detect zoom vs drag event [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
How to detect zoom vs drag event on MKMapView.
I want to reload the map in case users want to drag/scroll map to new position. I don't want to reload the Map with zoom in/out event.
I found a solution :(. really simple
1. keep the previous zoom level.
2. in the regionDidChangeAnimated method, get new zoom level of Map and check it with the previous level.
this is my code.
#define MERCATOR_RADIUS 85445659.44705395
#define kVerySmallValue (0.000001)
- (BOOL)compare2Double:(double)first isEqualTo:(double)second {
if(fabs(first - second) < kVerySmallValue)
return YES;
else
return NO;
}
- (double)getZoomLevel
{
static double maxGoogleLevels = -1.0;
if (maxGoogleLevels < 0.0)
maxGoogleLevels = log2(MKMapSizeWorld.width / 256.0);
CLLocationDegrees longitudeDelta = self.mapView.region.span.longitudeDelta;
CGFloat mapWidthInPixels = self.mapView.bounds.size.width;
double zoomScale = longitudeDelta * MERCATOR_RADIUS * M_PI / (180.0 * mapWidthInPixels);
double zoomer = maxGoogleLevels - log2( zoomScale );
if ( zoomer < 0 ) zoomer = 0;
NSLog(#"zoom: %f",zoomer);
return zoomer;
}
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
double newZoom = [self getZoomLevel];
if ([self compareDouble:newZoom isEqualTo:zoomLevel]) {
NSLog(#"Drag");
}else{
zoomLevel = newZoom;
NSLog(#"Zoom");
}
}
You can find out through the below methods of PangestureRecognizer
- (void)viewDidLoad
{
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:#selector(dragMap:)];
panGesture.delegate = self;
[mapView addGestureRecognizer:panGesture];
}
-(void)dragMap:(UIPanGestureRecognizer*) gestureRecognizer
{
if(gestureRecognizer.state == UIGestureRecognizerStateBegan)
{
NSLog(#"The mapView Dragged");
}
}
I understand the problem.
Zoom or drag both the cases call regionWillChangeAnimated and regionDidChangeAnimated you want to differentiate between zoom and drag.
In MapViewControllerDelegate
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
// check mapView.centerCoordinate
// if mapView.centerCoordinate is equal previousCenterCoordinate {
// ZOOM
// } else {
//pinch gesture
//}
}
Update:
I thought my previous example will work. But it did not. This is my second attempt.
Add a method getZoomLevel
#define MERCATOR_OFFSET 268435456
#define MERCATOR_RADIUS 85445659.44705395
- (double) getZoomLevel
{
return 20.00 - log2(self.region.span.longitudeDelta * MERCATOR_RADIUS * M_PI / (180.0 * self.bounds.size.width));
}
In this method, self is mapView. I have a category of MKMapView so it is self in my case.
In MapViewControllerDelegate
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
// zoomLevel = [mapView getZoomLevel]; // or [self getZoomLevel] in your case
// if zoomLevel isEqual previousZoomLevel {
// did drag
// } else {
// did zoom
// previousZoomLevel = zoomLevel
//}
}

Convert GMSVisibleRegion to CLRegion or MKCoordinateRegion

I am using the GoogleMaps SDK and currently I am trying to convert a GMSVisibleRegion to a CLRegion.
GMSVisibleRegion is defined as:
typedef struct {
CLLocationCoordinate2D nearLeft;
CLLocationCoordinate2D nearRight;
CLLocationCoordinate2D farLeft;
CLLocationCoordinate2D farRight;
} GMSVisibleRegion;
What is the fastest way to do so?
Unfortunately it is difficult to understand what the developer meant with the naming "near" and "far". I think this comment can also be useful:
/**
* Returns the region (four location coordinates) that is visible according to
* the projection.
*
* The visible region can be non-rectangular. The result is undefined if the
* projection includes points that do not map to anywhere on the map (e.g.,
* camera sees outer space).
*/
- (GMSVisibleRegion)visibleRegion;
Thanks a lot!
EDIT:
Ok my first step was to create a MKCoordinateRegion of a GMSVisibleRegion.
I propose the following code to transform a a GMSVisibleRegion to a MKCoordinateRegion. Any objections.
+ (MKCoordinateRegion)regionForCenter:(CLLocationCoordinate2D)center andGMSVisibleRegion:(GMSVisibleRegion)visibleRegion
{
CLLocationDegrees latitudeDelta = visibleRegion.farLeft.latitude - visibleRegion.nearLeft.latitude;
CLLocationDegrees longitudeDelta = visibleRegion.farRight.longitude - visibleRegion.farLeft.longitude;
MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta);
return MKCoordinateRegionMake(center, span);
}
My guess is that 'near' is for the corners of the view at the bottom of the screen, and 'far' is for the corners at the top of the screen. This is because if you've tilted the view, then the bottom corners are nearest to the camera, and the top corners are furthest from the camera.
One way to turn this into a CLRegion might be to use the camera's target as the centre, and then calculate the radius from the maximum distance to the four corners. This might not be the tightest fitting circle over the region, but since a circle can't fit the quadrilateral of the view anyway, it may be close enough.
Here's a helper function to calculate the distance in metres between two CLLocationCoordinate values:
double getDistanceMetresBetweenLocationCoordinates(
CLLocationCoordinate2D coord1,
CLLocationCoordinate2D coord2)
{
CLLocation* location1 =
[[CLLocation alloc]
initWithLatitude: coord1.latitude
longitude: coord1.longitude];
CLLocation* location2 =
[[CLLocation alloc]
initWithLatitude: coord2.latitude
longitude: coord2.longitude];
return [location1 distanceFromLocation: location2];
}
Then the CLRegion can be calculated like this:
GMSMapView* mapView = ...;
...
CLLocationCoordinate2D centre = mapView.camera.target;
GMSVisibleRegion* visibleRegion = mapView.projection.visibleRegion;
double nearLeftDistanceMetres =
getDistanceMetresBetweenLocationCoordinates(centre, visibleRegion.nearLeft);
double nearRightDistanceMetres =
getDistanceMetresBetweenLocationCoordinates(centre, visibleRegion.nearRight);
double farLeftDistanceMetres =
getDistanceMetresBetweenLocationCoordinates(centre, visibleRegion.farLeft);
double farRightDistanceMetres =
getDistanceMetresBetweenLocationCoordinates(centre, visibleRegion.farRight);
double radiusMetres =
MAX(nearLeftDistanceMetres,
MAX(nearRightDistanceMetres,
MAX(farLeftDistanceMetres, farRightDistanceMetres)));
CLRegion region = [[CLRegion alloc]
initCircularRegionWithCenter: centre radius: radius identifier: #"id"];
UPDATE:
Regarding your update for MKCoordinateRegion, your example code may not work. If the map has been rotated 90 degrees, then farLeft and nearLeft will have the same latitude, and farRight and farLeft will have the same longitude, and so your latitude and longitude deltas would be zero.
You would need to loop over all four of the farLeft, farRight, nearLeft, nearRight, calculate the min and max of the latitude and longitude of each, and then calculate the delta from that.
The Google Maps SDK for iOS includes a helper class which already does some of this for you - GMSCoordinateBounds. It can be initialized with a GMSVisibleRegion:
GMSMapView* mapView = ...;
....
GMSVisibleRegion visibleRegion = mapView.projection.visibleRegion;
GMSCoordinateBounds bounds =
[[GMSCoordinateBounds alloc] initWithRegion: visibleRegion];
The GMSCoordinateBounds then has northEast and southWest properties which define the bounds. So you could calculate the deltas as follows:
CLLocationDegrees latitudeDelta =
bounds.northEast.latitude - bounds.southWest.latitude;
CLLocationDegrees longitudeDelta =
bounds.northEast.longitude - bounds.southWest.longitude;
You could also calculate the centre from the bounds, and therefore the MKCoordinateRegion:
CLLocationCoordinate2D centre = CLLocationCoordinate2DMake(
(bounds.southWest.latitude + bounds.northEast.latitude) / 2,
(bounds.southWest.longitude + bounds.northEast.longitude) / 2);
MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta);
return MKCoordinateRegionMake(centre, span);
Addendum for purists
If you want to be absolutely rigorous there's a correction you need to make around the international dateline. It would be a waste of effort in most apps but this problem has been causing me major grief as of late so I thought to throw it into the community hat
Building on Druce's update (afraid I can't make comments)...
GMSMapView* mapView = ...;
....
GMSVisibleRegion visibleRegion = mapView.projection.visibleRegion;
GMSCoordinateBounds bounds =
[[GMSCoordinateBounds alloc] initWithRegion: visibleRegion];
Latitude doesn't need anything doing to it
CLLocationDegrees latitudeDelta =
bounds.northEast.latitude - bounds.southWest.latitude;
The deal runs that a region that spans the international dateline might have a southWest corner in Japan (+140 longitude) and its northEast corner in Alaska (-150 longitude). Adding up and dividing by two gives a point around the wrong side of the globe.
The special case where northEast.longitude is less than southWest.longitude needs handling
CLLocationCoordinate2D centre;
CLLocationDegrees longitudeDelta;
if(bounds.northEast.longitude >= bounds.southWest.longitude) {
//Standard case
centre = CLLocationCoordinate2DMake(
(bounds.southWest.latitude + bounds.northEast.latitude) / 2,
(bounds.southWest.longitude + bounds.northEast.longitude) / 2);
longitudeDelta = bounds.northEast.longitude - bounds.southWest.longitude;
} else {
//Region spans the international dateline
centre = CLLocationCoordinate2DMake(
(bounds.southWest.latitude + bounds.northEast.latitude) / 2,
(bounds.southWest.longitude + bounds.northEast.longitude + 360) / 2);
longitudeDelta = bounds.northEast.longitude + 360
- bounds.southWest.longitude;
}
MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta);
return MKCoordinateRegionMake(centre, span);
For anyone looking for boilerplate code based on all the answers and corrections provided so far, here's region implemented as a category on GMSMapView:
//
// GMSMapViewExtensions.h
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>
#interface GMSMapView (GMSMapViewExtensions)
#end
and
//
// GMSMapViewExtensions.m
//
#import "GMSMapViewExtensions.h"
#implementation GMSMapView (GMSMapViewExtensions)
- (MKCoordinateRegion) region {
GMSVisibleRegion visibleRegion = self.projection.visibleRegion;
GMSCoordinateBounds * bounds = [[GMSCoordinateBounds alloc] initWithRegion: visibleRegion];
CLLocationDegrees latitudeDelta = bounds.northEast.latitude - bounds.southWest.latitude;
CLLocationCoordinate2D centre;
CLLocationDegrees longitudeDelta;
if (bounds.northEast.longitude >= bounds.southWest.longitude) {
// Standard case
centre = CLLocationCoordinate2DMake(
(bounds.southWest.latitude + bounds.northEast.latitude) / 2,
(bounds.southWest.longitude + bounds.northEast.longitude) / 2);
longitudeDelta = bounds.northEast.longitude - bounds.southWest.longitude;
} else {
// Region spans the international dateline
centre = CLLocationCoordinate2DMake(
(bounds.southWest.latitude + bounds.northEast.latitude) / 2,
(bounds.southWest.longitude + bounds.northEast.longitude + 360) / 2);
longitudeDelta = bounds.northEast.longitude + 360 - bounds.southWest.longitude;
}
MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta);
return MKCoordinateRegionMake(centre, span);
}
- (MKMapRect)visibleMapRect {
MKCoordinateRegion region = [self region];
MKMapPoint a = MKMapPointForCoordinate(CLLocationCoordinate2DMake(
region.center.latitude + region.span.latitudeDelta / 2,
region.center.longitude - region.span.longitudeDelta / 2));
MKMapPoint b = MKMapPointForCoordinate(CLLocationCoordinate2DMake(
region.center.latitude - region.span.latitudeDelta / 2,
region.center.longitude + region.span.longitudeDelta / 2));
return MKMapRectMake(MIN(a.x, b.x), MIN(a.y, b.y), ABS(a.x - b.x), ABS(a.y - b.y));
}
#end
Usage example:
GMSMapView * mapView = .... // init code
MKCoordinateRegion mapRegion = mapView.region;
Based on answer of #Saxon Druce, this is a quick extension on setting and getting region using MKCoordinateRegion on GMSMapView
extension GMSMapView {
var region : MKCoordinateRegion {
get {
let position = self.camera
let visibleRegion = self.projection.visibleRegion()
let bounds = GMSCoordinateBounds(region: visibleRegion)
let latitudeDelta = bounds.northEast.latitude - bounds.southWest.latitude
let longitudeDelta = bounds.northEast.longitude - bounds.southWest.longitude
let center = CLLocationCoordinate2DMake(
(bounds.southWest.latitude + bounds.northEast.latitude) / 2,
(bounds.southWest.longitude + bounds.northEast.longitude) / 2)
let span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta)
return MKCoordinateRegionMake(center, span)
}
set {
let northEast = CLLocationCoordinate2DMake(newValue.center.latitude - newValue.span.latitudeDelta/2, newValue.center.longitude - newValue.span.longitudeDelta/2)
let southWest = CLLocationCoordinate2DMake(newValue.center.latitude + newValue.span.latitudeDelta/2, newValue.center.longitude + newValue.span.longitudeDelta/2)
let bounds = GMSCoordinateBounds(coordinate: northEast, coordinate: southWest)
let update = GMSCameraUpdate.fitBounds(bounds, withPadding: 0)
self.moveCamera(update)
}
}
}

Drawing Great Circle overlay lines on an MKMapView

I'm trying to draw a Great Circle line between two lat/lon points on an MKMapView. This is a line that would appear rounded (a 'straight' line on a globe) and is best visualized here. In fact this very odd WordPress site seems to begin to describe exactly how to do this, but it ends abruptly after the first few steps.
Reading in Apple's documentation I see
In iOS 4.0 and later, you can also use projected map coordinates instead of regions to specify some values. When you project the curved surface of the globe onto a flat surface, you get a two-dimensional version of a map where longitude lines appear to be parallel. Locations and distances on this map are specified using the MKMapPoint, MKMapSize, and MKMapRect data types. You can use these data types to specify the map’s visible region and when specifying the location of overlays.
How I would apply this to a Great Circle overlay I'm not sure. Can anyone help?
I've implemented this for drawing a great circle route for aircraft going between two airports using MKPolyline.
+ (void)createGreatCircleMKPolylineFromPoint:(CLLocationCoordinate2D)point1
toPoint:(CLLocationCoordinate2D)point2
forMapView:(MKMapView*)mapView
{
double lat1 = point1.latitude;
double lon1 = point1.longitude;
double lat2 = point2.latitude;
double lon2 = point2.longitude;
lat1 = lat1 * (PI/180);
lon1 = lon1 * (PI/180);
lat2 = lat2 * (PI/180);
lon2 = lon2 * (PI/180);
double d = 2 * asin( sqrt(pow(( sin( (lat1-lat2)/2) ), 2) + cos(lat1) * cos(lat2) * pow(( sin( (lon1-lon2)/2) ), 2)));
int numsegs = 100;
CLLocationCoordinate2D *coords = malloc(sizeof(CLLocationCoordinate2D) * numsegs);
double f = 0.0;
for(int i=1; i<=numsegs; i++)
{
f += 1.0 / (float)numsegs;
double A=sin((1-f)*d)/sin(d);
double B=sin(f*d)/sin(d);
double x = A*cos(lat1) * cos(lon1) + B * cos(lat2) * cos(lon2);
double y = A*cos(lat1) * sin(lon1) + B * cos(lat2) * sin(lon2);
double z = A*sin(lat1) + B*sin(lat2);
double latr=atan2(z, sqrt(pow(x, 2) + pow(y, 2) ));
double lonr=atan2(y, x);
double lat = latr * (180/PI);
double lon = lonr * (180/PI);
// NSLog(#"lat: %f lon: %f", lat, lon);
CLLocationCoordinate2D loc = CLLocationCoordinate2DMake(lat, lon);
coords[i - 1] = loc;
}
//check for circling west to east. If the plane is crossing 180, we need
//to draw two lines or else the polyline connects the dots and draws a straight
//line all the way across the map.
CLLocationCoordinate2D prevCoord;
BOOL twoLines = NO;
int numsegs2 = 0;
CLLocationCoordinate2D *coords2;
for(int i=0; i<numsegs; i++)
{
CLLocationCoordinate2D coord = coords[i];
if(prevCoord.longitude < -170 && prevCoord.longitude > -180 && prevCoord.longitude < 0
&& coord.longitude > 170 && coord.longitude < 180 && coord.longitude > 0)
{
twoLines = YES;
coords2 = malloc(sizeof(CLLocationCoordinate2D) * (numsegs - i));
numsegs2 = numsegs - i;
for(int j=0; j<numsegs2; j++)
{
coords2[j] = coords[i + j];
}
break;
}
prevCoord = coord;
}
//remove any previously added overlays
[mapView removeOverlays:mapView.overlays];
if(twoLines)
{
MKPolyline *polyline = [MKPolyline polylineWithCoordinates:coords count:numsegs - numsegs2];
free(coords);
[mapView addOverlay:polyline];
MKPolyline *polyline2 = [MKPolyline polylineWithCoordinates:coords2 count:numsegs2];
free(coords2);
[mapView addOverlay:polyline2];
}
else
{
MKPolyline *polyline = [MKPolyline polylineWithCoordinates:coords count:numsegs];
free(coords);
[mapView addOverlay:polyline];
}
}
You've now created the overlay(s), now you just need to provide an MKOverlayView in mapView:viewForOverlay.
- (MKOverlayView*)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay
{
MKPolyline *polyline = (MKPolyline*)overlay;
MKPolylineView *view = [[[MKPolylineView alloc] initWithPolyline:polyline] autorelease];
//choose your line params here
view.lineWidth = 2;
view.fillColor = [UIColor blueColor];
return view;
}
Hope this helps.
Screenshot http://s1-03.twitpicproxy.com/photos/large/489178500.png
It is late in the game, but worth mentioning MKGeodesicPolyline, new since iOS 7.0, which 'traces the shortest path along the surface of the Earth'.
With this it becomes simple to create and add an MKPolylineOverlay of type Geodesic Polyline.
points = [CLLocationCoordinate2DMake(27.123, 85.765),
CLLocationCoordinate2DMake(41.444, 106.987)]
geodesic = MKGeodesicPolyline(coordinates: points, count: 2)
mapView.add(geodesic)
remember to include the renderer and give the mapView a delegate:
//MARK: - MKMapView Delegate Method
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if overlay is MKGeodesicPolyline {
let polylineRenderer = MKPolylineRenderer(overlay: overlay)
polylineRenderer.strokeColor = UIColor.white
polylineRenderer.lineWidth = 2.5
return polylineRenderer
}
}
This can be accomplish creating a subclass of the MKOverlayPathView class. You need to override the (void)createPath method, and basically you could use a UIBezierPath to create the arc, or create an arc as path directly, which is possible but I haven't done it yet.
Once you define the path on the method, you need to set the path property of the class with the newly created path. That way, the rendering of the path is going to be done automatically.
Hope this helps.
The numsegs parameter should be changeable according to the map zoom level and the distance of the two points. The lat/lon coordinate of the two points can be transformed into pixel coordinate. Thus the numsegs parameter can be viewed as a function of pixel differences.

determine current zoomscale for mapview

How can I calculate the current zoomScale for an MKMapView?
Use the following code:
#define MERCATOR_RADIUS 85445659.44705395
#define MAX_GOOGLE_LEVELS 20
- (double)getZoomLevel {
CLLocationDegrees longitudeDelta = self.mapView.region.span.longitudeDelta;
CGFloat mapWidthInPixels = self.mapView.bounds.size.width;
double zoomScale = longitudeDelta * MERCATOR_RADIUS * M_PI / (180.0 * mapWidthInPixels);
double zoomer = MAX_GOOGLE_LEVELS - log2( zoomScale );
if ( zoomer < 0 ) zoomer = 0;
// zoomer = round(zoomer);
return zoomer;
}
The return value of the getZoomLevel method will be the current zoom level of your mapView property.

Resources