Module: Antipodes
- Defined in:
- lib/antipodes.rb,
lib/antipodes/version.rb
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
-
.for(*params) ⇒ Array
The antipodal point given as
[latitude, longitude]
.
Class Method Details
.for(*params) ⇒ Array
Returns the antipodal point given as [latitude, longitude]
.
8 9 10 11 12 13 14 |
# File 'lib/antipodes.rb', line 8 def self.for(*params) latitude, longitude = params.size > 1 ? params : Geocoder.search(params.first).first.coordinates antipodal_latitude = latitude > 0 ? -latitude : latitude.abs antipodal_longitude = longitude > 0 ? longitude - 180 : longitude + 180 [antipodal_latitude, antipodal_longitude] end |