module GTFS::Realtime::Nearby::ClassMethods

Public Instance Methods

nearby(latitude, longitude) click to toggle source
# File lib/gtfs/realtime/nearby.rb, line 16
def nearby(latitude, longitude)
  # TODO: this math is terrible! It'll fail for various edge cases.
  # (e.g. close to the poles, overlapping to the prime meridian)
  # That said, it's an okay approximation away from the poles/meridian.

  all.select do |item|
    item.distance(latitude, longitude) < 0.01
  end
end