module Geocoder::Sql

def approx_bearing(latitude, longitude, lat_attr, lon_attr, options = {})


returns *something* in databases without trig functions.
Totally lame bearing calculation. Basically useless except that it
#
def approx_bearing(latitude, longitude, lat_attr, lon_attr, options = {})
  "CASE " +
    "WHEN (#{lat_attr} >= #{latitude.to_f} AND " +
      "#{lon_attr} >= #{longitude.to_f}) THEN  45.0 " +
    "WHEN (#{lat_attr} <  #{latitude.to_f} AND " +
      "#{lon_attr} >= #{longitude.to_f}) THEN 135.0 " +
    "WHEN (#{lat_attr} <  #{latitude.to_f} AND " +
      "#{lon_attr} <  #{longitude.to_f}) THEN 225.0 " +
    "WHEN (#{lat_attr} >= #{latitude.to_f} AND " +
      "#{lon_attr} <  #{longitude.to_f}) THEN 315.0 " +
  "END"
end