Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_units/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#parse_dms(direction = nil) ⇒ Object



49
50
51
52
# File 'lib/geo_units/core_ext.rb', line 49

def parse_dms direction = nil
  lng, lat = extract_coords(direction)
  direction == :lat_lng ? [lat.parse_dms, lng.parse_dms] : [lng.parse_dms, lat.parse_dms]
end

#to_dms(direction = nil) ⇒ Object



43
44
45
46
47
# File 'lib/geo_units/core_ext.rb', line 43

def to_dms direction = nil
  lng, lat = extract_coords(direction)
  res = direction == :lat_lng ? [lat.to_lat_dms, lng.to_lng_dms] : [lng.to_lng_dms, lat.to_lat_dms]
  res.join(', ')    
end