module Geocoder::ActiveRecord::ClassMethods

def coordinate_bounds(latitude, longitude, radius)


Used to constrain search to a (radius x radius) square.
radius. Returns an array: [lat_lo, lat_hi, lon_lo, lon_hi].
Get the rough high/low lat/long bounds for a geographic point and
#
def coordinate_bounds(latitude, longitude, radius)
  radius = radius.to_f
  factor = (Math::cos(latitude * Math::PI / 180.0) * 69.0).abs
  [
    latitude  - (radius / 69.0),
    latitude  + (radius / 69.0),
    longitude - (radius / factor),
    longitude + (radius / factor)
  ]
end