Dealing with data in a location friendly manner is not a new problem. Way past, when Apex was, however, a brand new language and lacked some higher mathematical functions like sine and cosine Trying to determine location without things like sine and cosine was technically not possible. So that was three things that salesforce lacked. One solution can be to tag data based on a database that could translate ZIP codes into latitude and longitude and then do queries based on squares. Because when you don’t have trig on your side, squares are much easier to deal with.
Although it was too hectic as a task, it was also kind of fun.
But now after Winter ’13, you can get even more awesome without the hackery. Continue reading