Module: GPS_PVT::Ntrip::MountPoints

Defined in:
lib/gps_pvt/ntrip.rb

Constant Summary collapse

D2R =
Math::PI / 180

Instance Method Summary collapse

Instance Method Details

#near_from(lat_deg, lng_deg) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/gps_pvt/ntrip.rb', line 52

def near_from(lat_deg, lng_deg)
  require 'gps_pvt/Coordinate'
  llh0 = Coordinate::LLH::new(D2R * lat_deg, D2R * lng_deg, 0)
  collect{|pt, prop|
    llh = Coordinate::LLH::new(*([:latitude, :longitude].collect{|k| D2R * prop[k].to_f} + [0]))
    [llh0.xyz.distance(llh.xyz), prop]
  }.sort{|a, b| a[0] <=> b[0]} # return [distance, property]
end