I'm using a query I found on stackoverflow for finding locations near a given latitude/longitude in a database. Below is the query. Entirely out of curiosity, can someone explain what exactly it's doing (the math bits, not the sql)? 44.xxx and -93.xxx is the lat/long to start from.
Thanks!
SELECT id, ( 3959 * acos( cos( radians(44.96577) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(-93.268433) ) + sin( radians(44.907411) ) * sin( radians( latitude ) ) ) ) AS distance FROM ivr_sign.property HAVING distance < 10 ORDER BY distance ASC, id ASC LIMIT 10