lib/map-kit-wrapper/zoom_level.rb
def zoom_level
      region = self.region
      center_pixel = region.center.to_pixel_space
      top_left_pixel = (region.center - (region.span / 2)).to_pixel_space

      scaled_map_width = (center_pixel.x - top_left_pixel.x) * 2
      map_size_in_pixels = MapSize.new(self.bounds.size)

      zoom_scale = scaled_map_width / map_size_in_pixels.width
      zoom_exponent = log(zoom_scale) / log(2)
      20 - zoom_exponent
    end
def zoom_level
      region = self.region
      center_pixel = region.center.to_pixel_space
      top_left_pixel = (region.center - (region.span / 2)).to_pixel_space

      scaled_map_width = (center_pixel.x - top_left_pixel.x) * 2
      map_size_in_pixels = MapSize.new(self.bounds.size)

      zoom_scale = scaled_map_width / map_size_in_pixels.width
      zoom_exponent = log(zoom_scale) / log(2)
      20 - zoom_exponent
    end
def zoom_level region = self . region center_pixel = region . center . to_pixel_space top_left_pixel = ( region . center - ( region . span / 2 ) ) . to_pixel_space scaled_map_width = ( center_pixel . x - top_left_pixel . x ) * 2 map_size_in_pixels = MapSize . new ( self . bounds . size ) zoom_scale = scaled_map_width / map_size_in_pixels . width zoom_exponent = log ( zoom_scale ) / log ( 2 ) 20 - zoom_exponent end
Get the current zoom level

 * *Returns* :
   - Zoom level as a Float
Get the current zoom level