> For the complete documentation index, see [llms.txt](https://docs.wisej.com/extensions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/extensions/extensions/geolocation.md).

# Geolocation

The Geolocation extension component adds geolocation capabilities to the container it is dropped on. Provides methods to retrieve the current location of the client and raises events when the location changes.

{% embed url="<https://github.com/iceteagroup/wisej-extensions/tree/master/Wisej.Ext.Geolocation>" %}
Geolocation Source Code
{% endembed %}

## How to Use

The **Geolocation** extension can be added to a Wisej.NET project using NuGet Package Manager.

{% embed url="<https://www.nuget.org/packages/Wisej-3-Geolocation>" %}

You can add a Geolocation component by dragging it from the toolbox into the designer.

Geolocation supports an *ActiveWatch* which fires a *PositionChanged* event when the location of the Device changes.

Depending on your device you can control the Geolocation component with *EnableHighAccuracy* and by defining a *Timeout* for detecting the position.

Retrieve the current position with *GetCurrentPositionAsync*.

```csharp
// Get location and show location information in an AlertBox on button click
private async void button1_Click(object sender, EventArgs e)
	{
		var position = await this.geolocation1.GetCurrentPositionAsync();
		AlertBox.Show(position.ToJSON());
	}
```

{% hint style="info" %}
The user may need to allow the browser to read the geolocation.
{% endhint %}
