Method: Geocoder::Calculations#compass_point

Defined in:
lib/geocoder/calculations.rb

#compass_point(bearing, points = COMPASS_POINTS) ⇒ Object

Translate a bearing (float) into a compass direction (string, eg “North”).



156
157
158
159
# File 'lib/geocoder/calculations.rb', line 156

def compass_point(bearing, points = COMPASS_POINTS)
  seg_size = 360.0 / points.size
  points[((bearing + (seg_size / 2)) % 360) / seg_size]
end