> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codenullapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get current location GPS

> Call the getCurrentLocationAsync() function provided by the helpers module.

### **How to Use getCurrentLocationAsync()**

Call the `getCurrentLocationAsync()` function provided by the `helpers` module.

```javascript theme={null}
var location = await helpers.getCurrentLocationAsync();
```

Access the latitude, longitude, and map URL properties of the `location` object returned by the function:

```javascript theme={null}
var latitude = location.latitude; // Example: 37.7749
var longitude = location.longitude; // Example: -122.4194
var mapUrl = location.mapUrl; // Example: "https://www.google.com/maps?q=37.7749,-122.4194"
```

```javascript theme={null}
//async call
helpers.getCurrentLocationAsync()
    .then(result => helpers.options.setFieldValue("fieldName", result));
    
//result object structure
// {
//    latitude: 9.161733, 
//    longitude: -74.6406, 
//    mapUrl: "https://www.openstreetmap.org/#map=18/6.161733080440801/-75.64064618359605"
// }
```

* `latitude`: Represents the user's current latitude coordinate.
* `longitude`: Represents the user's current longitude coordinate.
* `mapUrl`: Provides a URL link to view the user's location on a map.

Ensure to handle the asynchronous nature of the function appropriately, as the location data may not be immediately available upon invocation.
