def approx_distance(latitude, longitude, lat_attr, lon_attr, options = {})
      units = options[:units] || Geocoder.config.units
      dx = Geocoder::Calculations.longitude_degree_distance(30, units)
      dy = Geocoder::Calculations.latitude_degree_distance(units)

      # sin of 45 degrees = average x or y component of vector
      factor = Math.sin(Math::PI / 4)

      "(#{dy} * ABS(#{lat_attr} - #{latitude.to_f}) * #{factor}) + " +
        "(#{dx} * ABS(#{lon_attr} - #{longitude.to_f}) * #{factor})"
    end
def approx_distance(latitude, longitude, lat_attr, lon_attr, options = {})
      units = options[:units] || Geocoder.config.units
      dx = Geocoder::Calculations.longitude_degree_distance(30, units)
      dy = Geocoder::Calculations.latitude_degree_distance(units)

      # sin of 45 degrees = average x or y component of vector
      factor = Math.sin(Math::PI / 4)

      "(#{dy} * ABS(#{lat_attr} - #{latitude.to_f}) * #{factor}) + " +
        "(#{dx} * ABS(#{lon_attr} - #{longitude.to_f}) * #{factor})"
    end
Distance calculation for use with a database without trigonometric
 functions, like SQLite. Approach is to find objects within a square
 rather than a circle, so results are very approximate (will include
 objects outside the given radius).

 Distance and bearing calculations are *extremely inaccurate*. To be
 clear: this only exists to provide interface consistency. Results
 are not intended for use in production!