Method: MapKit::ZoomLevel::ClassMethods#pixel_space_y_to_latitude

Defined in:
lib/map-kit-wrapper/zoom_level.rb

#pixel_space_y_to_latitude(pixel_y) ⇒ Object

Convert pixel space y to latitude

  • Args :

    • pixel_y -> Int

  • Returns :

    • Latitude as float



81
82
83
# File 'lib/map-kit-wrapper/zoom_level.rb', line 81

def pixel_space_y_to_latitude(pixel_y)
  (PI / 2.0 - 2.0 * atan(exp((pixel_y.round - MERCATOR_OFFSET) / MERCATOR_RADIUS))) * 180.0 / PI
end