From f02ecbaea06b7ac2e5288abed944431df0b964d8 Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Sat, 29 Sep 2012 14:21:10 -0400
Subject: [PATCH] Improve code comments.

---
 lib/geocoder/sql.rb | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/geocoder/sql.rb b/lib/geocoder/sql.rb
index e5877561..69c146a9 100644
--- a/lib/geocoder/sql.rb
+++ b/lib/geocoder/sql.rb
@@ -3,7 +3,11 @@ module Geocoder
     extend self
 
     ##
-    # Distance calculation based on the excellent tutorial at:
+    # Distance calculation for use with a database that supports POWER(),
+    # SQRT(), PI(), and trigonometric functions SIN(), COS(), ASIN(),
+    # ATAN2(), DEGREES(), and RADIANS().
+    #
+    # Based on the excellent tutorial at:
     # http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
     #
     def full_distance(latitude, longitude, lat_attr, lon_attr, options = {})
@@ -16,6 +20,16 @@ module Geocoder
       "))"
     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!
+    #
     def approx_distance(latitude, longitude, lat_attr, lon_attr, options = {})
       dx = Geocoder::Calculations.longitude_degree_distance(30, options[:units] || :mi)
       dy = Geocoder::Calculations.latitude_degree_distance(options[:units] || :mi)
-- 
GitLab