class S2Cells::S2LatLon
Public Class Methods
new(lat_degrees, lon_degrees)
click to toggle source
# File lib/s2_cells/s2_lat_lon.rb, line 5 def initialize(lat_degrees, lon_degrees) @lat = lat_degrees * Math::PI / 180 @lon = lon_degrees * Math::PI / 180 end
Public Instance Methods
to_point()
click to toggle source
# File lib/s2_cells/s2_lat_lon.rb, line 10 def to_point phi = @lat theta = @lon cosphi = Math.cos(phi) S2Point.new(Math.cos(theta) * cosphi, Math.sin(theta) * cosphi, Math.sin(phi)) end
to_s2_id(level)
click to toggle source
# File lib/s2_cells/s2_lat_lon.rb, line 17 def to_s2_id(level) S2CellId.from_point(to_point) .parent(level) .signed_id end