module Nmea::DddFormatable

Protected Instance Methods

dmm_to_ddd(dmm, direction) click to toggle source
# File lib/nmea_gps.rb, line 27
def dmm_to_ddd(dmm, direction)
  dmm = dmm.to_f / 100
  integer = dmm.to_i
  decimal = dmm % 1

  (integer + decimal / 60  * 100.0) * ("NE".include?(direction) ? 1 : -1)
end