In Summer ’12, a new pilot program feature is introduced to support Geolocations. The new composite field type, geolocation, consists of two components: longitude and latitude. It is specifically designed to hold the geo-coordinates of a location for any objects, most commonly address related objects, such as Contact, Account, restaurants, shops, etc. When a geolocation field is added to these objects, and coordinates are set, users can perform radius based search. Some examples: to find the records of restaurants within 5 miles of my current location, to find all the homes within 15 miles of a sports arena, etc.
Geolocation for Mobile Apps
Mobile applications will find this new feature especially handy for providing mobile location-based search on Salesforce objects. Just like a regular custom field type, the geolocation field can be added to an object through object setup wizard. Decimal point precision can be set. Users have the choice to display coordinates in decimal point or degree, minute, and second notations. List views for objects with a geolocation field have a WITHIN operator to conduct radius based searching and filtering. You can perform distance calculation between two geolocation points using the DISTANCE(loc1, loc2, distance_unit) function inside formula fields.
Also, SOQL is enhanced with DISTANCE and GEOLOCATION functions that let you write SOQL queries to perform location-based searches. For example, to find the names and phone numbers of all restaurantswithin 1 mile of 1 Market Street, San Francisco, California, which has a geo coordinate of 37.794915,-122.394733, you can write a SOQL query as:
The Geolocation pilot is currently limited to Sandbox and Developer Edition orgs with Summer ’12. To request access to the pilot feature, please contact salesforce.com support and request to participate in “Geolocation Field Type Pilot program.”
Enter the Mobile Developer Challenge!
Take what you’ve learned from this post, use it to build your own mobile app, and then enter it in our Mobile Developer Challenge for a chance to win some serious cash!