Saturday, June 1, 2013

SOQL + Geolocation = Proximity Search

Well at last, there is something I am really cheerful to write about (there have been other things, but sometimes I was busy, other times it was not this exciting).

The other day, I was looking at a project requirement, wherein we need to filter certain records based on their proximity to a certain location. As per current features, you’ll have to pull all relevant records and then calculate the distance between the desired location and record’s location and then determine its proximity.
Now, with Summer ’12, SOQL has been equipped with two new powerful functions, which would help you in doing just the same, without even getting into nitty-gritty of proximity calculation.

GEOLOCATION is function added to convert a given Lattitude-Longitude to a gelolocation.

DISTANCE is function added to calculate distance between two geolocations.


No comments:

Post a Comment

Popular Posts