# Get current location GPS

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

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

```javascript
var location = await helpers.getCurrentLocationAsync();
```

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

```javascript
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
//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.


---

# 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://codenull.gitbook.io/dev/configurations/integrations/get-current-location-gps.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.
