# Latitude, Longitude, and Special Formulas

*Skill Level: Intermediate*

## Before You Begin

* Ensure you have generated your [Google API Key](/database/location/getting-your-google-api-key.md)
* Know about the [location property type](/database/location/the-location-property-type.md) and [location magic text](/database/location/location-magic-text-and-formatting.md)
* You will need a paid Adalo plan to use this feature.
* Note that each time your app requests user location, your Google plan may be charged.

## &#x20;Walkthrough

{% tabs %}
{% tab title="Simple" %}

### Formatting

With latitude and longitude, you can also format the way the coordinates are displayed to your end user, by clicking on the **pencil icon** in the red Magic Text bubble whenever latitude and longitude is displayed in an input. Decimal is the default formatting.&#x20;

![](/files/TdCE6GmjDd908kc7Wc11)

### Use with the Maps Component

You can obtain much better Maps component performance, by setting the marker address to be a lattitude and longitude value rather than an address. This is because the address is already broken down into its most basic elements and does not have to be sent to Google twice to determine the marker's location on the map. Set the markers values as **Location Latitude,Location Longitude** as seen below:

![](/files/jDqRAKKmwxf34kYJWYAF)

### Using Distance Formulas

You can also combine latitude and longitude data with custom formulas to calculate the distance between two points in either kilometers or miles using two new functions.

* **Miles Calculation - MILES(latA, lonA, latB, lonB)**
* **Kilometer Calculation - KILOMETERS(latA, lonA, latB, lonB)**

&#x20;

![](/files/VksnYAjXr5cBEAKHEtRp)

You can setup your formula to calculate the distance between two points like so:

![](/files/MSLdwrhtnZi8MQVFcRJf)
{% endtab %}
{% endtabs %}

## Learn More

* As always, you can add suffixes and prefixes to your custom formulas to have them say miles, kilometers, etc.&#x20;
* You can also put additional parentheses around the distance calculation in formulas and multiply or divide it to get different distance denominations such as feet, meters, and others.
* Check out our [course in the App Academy](https://appacademy.adalo.com/course/geolocation-uber-airbnb) about using Location.

## Help

If you need additional help with this article, you can always ask in our [community forum](https://forum.adalo.com/)! Be sure to paste the link to this article in your post as well!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.adalo.com/database/location/latitude-longitude-and-special-formulas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
