GEOLOCATION

Returns a geolocation based on the provided latitude and longitude. Must be used with the DISTANCE function.

Use

GEOLOCATION(latitude, longitude) and replace latitude and longitude with the corresponding geolocation, numerical code values.

Tips

  • The GEOLOCATION function returns a location data type that can be used only by, and must be used with, the DISTANCE function. The GEOLOCATION function doesn’t work on its own.
Example: Distance Between a Custom Geolocation Field and Fixed Coordinates
Example: Distance Between a Custom Geolocation Field and Fixed Coordinates

DISTANCE(warehouse_location__c, GEOLOCATION(37.775,-122.418), 'km')

This formula returns the distance, in kilometers, between the warehouse and the known latitude and longitude 37.775°, -122.418° (San Francisco).