> For the complete documentation index, see [llms.txt](https://sryvkver.gitbook.io/cobi.bike/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sryvkver.gitbook.io/cobi.bike/namespaces/mobile/location.md).

# Location

A data class representing a geographic location.&#x20;

A location can consist of a latitude, longitude, timestamp and other information such as bearing, altitude and velocity.

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

```typescript
const onLocationChange = (value: Location, timestamp?: Date) => {
    console.log(value, timestamp);
};

COBI.mobile.location.read(onLocationChange); // Instantly get the current value
COBI.mobile.location.subscribe(onLocationChange);
COBI.mobile.location.unsubscribe(onLocationChange);
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const onLocationChange = (value, timestamp) => {
    console.log(value, timestamp);
};

COBI.mobile.location.read(onLocationChange); // Instantly get the current value
COBI.mobile.location.subscribe(onLocationChange);
COBI.mobile.location.unsubscribe(onLocationChange);
```

{% endtab %}
{% endtabs %}

{% content-ref url="/pages/HN6kecHOMO2hFwtgFl1T" %}
[Location](/cobi.bike/entities/location.md)
{% endcontent-ref %}

<details>

<summary>Example Response</summary>

```json
{
    "coordinate": {
        "latitude": 37.785834,
        "longitude": -122.406417
    },
    "altitude": 0,
    "bearing": 0,
    "speed": 0,
    "horizontalAccuracy": 0,
    "verticalAccuracy": 0
}
```

</details>
