---
url: https://talkjs.com/docs/Features/Messages/Location_Sharing
---

# Location sharing

Allow users to share their location within a conversation.

Ask a question Copy for LLM [View as Markdown](/docs/Features/Messages/Location_Sharing.md)
Location sharing lets users send a specific point on the map as a message, for example to share their current location, or the location of a meeting point. You could also use location sharing to give customers updates on the location of their order or delivery.

In the TalkJS chat UI, a shared location is rendered as a link to Google Maps, with a thumbnail showing the surrounding area and a pin at the specified coordinate.

Location sharing requires an HTTPS-secured connection, due to browser restrictions on geolocation access. Moreover, the user must give permission for the browser or app to access their location data.

## Enable location sharing

You can enable or disable location sharing for each user [role](/docs/Concepts/Roles/) in the **Chat UI** page of your [TalkJS dashboard](/dashboard). Select the role you want to edit, then enable or turn off the **Allow location sharing** setting in the **Features** section.

## Send locations programmatically

You can also send a message containing a location [using the REST API](/docs/REST_API/Messages/#send-a-message), by including a location content block in the message's content array:

```json
{
  "type": "location",
  "latitude": number,
  "longitude": number
}
```

`latitude` must be a number between -90 and 90, and `longitude` must be a number between -180 and 180.

Note that you can only include locations for regular user [messages](/docs/Concepts/Messages/), not [system messages](/docs/Concepts/System_Messages/). In addition, the user for which you programmatically share a location must be a [participant](/docs/Concepts/Participants/) in the conversation, not a [guest](/docs/Concepts/Guests/).

## See also

- [Message content: Locations](/docs/Concepts/Message_Content/#locations) gives a conceptual overview of location content blocks.
- JavaScript Data API: [LocationBlock](/docs/Data_APIs/JavaScript/Message_Content/#LocationBlock)
- Kotlin Data API: [LocationBlock](/docs/Data_APIs/Kotlin/Message_Content/#LocationBlock)
- Flutter Data API: [LocationBlock](/docs/Data_APIs/Flutter/Message_Content/#LocationBlock)
- Components SDKs: [`<LocationBlock>`](/docs/UI_Components/Theme/Theme_components/LocationBlock/) theme component
- React Native, Flutter, and Classic SDKs: [`<Thumbnail>`](/docs/UI_Components/JavaScript/Classic/Themes/Components/UserMessage/#thumbnail) subcomponent of `<UserMessage>`.
- REST API: [Messages](/docs/REST_API/Messages/) includes details on location data.