title: iPhone: Get Selected zoom level of Google map
body: <p>We need to get the current selected zoom level of MKMapView when user either
  zooms-in or zooms-out on the Google Maps using Mapkit.</p>
  
  <p>The solution we have tried is running fine on simulator but not on real
  device (iPhone 3GS having iOS 3.0.1). We need to get it running on iOS 3+
  (including iOS 4)</p>
  
  <p>Following is the code we are using to get the zoom-level:-</p>
  
  <p>On zoom-in/out, Mapkit calls this delegate:-</p>
  
  <pre><code>(void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
  </code></pre>
  
  <p>which in turns calls our Mapzoomlevel function:-</p>
  
  <pre><code>#define MERCATOR_RADIUS 85445659.44705395
  
  -(float) Mapzoomlevel {
    return 21 - round(log2(_mapView.region.span.longitudeDelta *
      MERCATOR_RADIUS * M_PI / (180.0 * _mapView.bounds.size.width)));
  }
  </code></pre>
  
  <p>This code was taken from (see get zoom level example first comment posted on
  this blog):-</p>
  
  <p><a href="http://troybrant.net/blog/2010/01/set-the-zoom-level-of-an-mkmapview/" rel="nofollow">http://troybrant.net/blog/2010/01/set-the-zoom-level-of-an-mkmapview/</a> </p>