---
schema_version: "1"
id: bda63d81fcf890ce8889751b9cc1edbd34e8ee3c43c1e5df0298d8a97e2874a6
title: GEOLOCATION
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/customize_functions_geolocation.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.customize_functions_geolocation.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 12cdea567921b9eba9ac3a91b6955efe29ec30843b90650dade038614fa5c274
description: Returns a geolocation based on the provided latitude and longitude. Must be used with the DISTANCE function.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# 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](https://help.salesforce.com/s/articleView?id=platform.customize_functions_distance.htm&release=264.0.0&type=5 "Calculates the distance between two locations in miles or kilometers.") function. The GEOLOCATION function doesn’t work on its own.

![Example: Distance Between a Custom Geolocation Field and Fixed Coordinates](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

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).