Location-based SOQL Queries
DISTANCE() now works with location and address fields. You can retrieve a specific distance (say, of a store from a contact’s location) and display it to the user.
For example:
SELECT Id, Name, Location, DISTANCE(Location, GEOLOCATION(latitude, longitude), 'mi') FROM CONTACT;
SELECT Name, BillingCity, BillingState, BillingCountry, BillingLatitude, BillingLongitude FROM Account WHERE DISTANCE(BillingAddress, GEOLOCATION(37.79340, -122.39420), 'mi') < 50 LIMIT 20
- Manage and assign territories with precision
- Show mobile users nearby customers and prospects
- Plot customers on a map to identify white space
- Segment customers by location
- Micro-target leads for events, email campaigns, etc.
- Track and log mileage
- Create location-based tasks (“Remind me at a location”)