Method: Mapstatic::Conversion#y_to_lat

Defined in:
lib/mapstatic/conversion.rb

#y_to_lat(y, zoom) ⇒ Object



21
22
23
24
25
# File 'lib/mapstatic/conversion.rb', line 21

def y_to_lat(y, zoom)
  n = 2.0 ** zoom
  lat_rad = Math.atan(Math.sinh(Math::PI * (1 - 2 * y / n)))
  lat_deg = lat_rad / (Math::PI / 180.0)
end