# reverse-geocoding

## Description

<mark style="color:purple;">`reverse-geocoding`</mark> *adaptor converts the latitude & longitude in datatable columns to location names.*

The latitude & longitude must be in +/- values, not E/W/N/S and not in degrees/minutes/seconds or degrees/decimal minutes.

## Inputs

**`data`**\
Type: `datatable`\
Required: Yes\
The datatable containing the latitude & longitude columns to be converted.

**`latitude column`**\
Type: `text`\
Required: No\
The name of the column containing latitude values (in decimal degrees). A plus sign (+) preceding the number denotes northern hemisphere, and a minus sign (-) denotes southern hemisphere. If unspecified, defaults to `latitude`.

**`longitude column`**\
Type: `text`\
Required: No\
The name of the column containing longitude values (in decimal degrees). A plus sign (+) denotes east longitude, and a minus sign (-) denotes west longitude. If unspecified, defaults to `longitude`.

**`location type`**\
Type: `text`\
Required: No\
The type of the geographic feature. Valid options are `address`, `position`, `country code`, `country name`, `ISO-3166-1-alpha-2`, `ISO-3166-1-alpha-3`, `ISO-3166-2`, `postcode`, `state name`, `state code`, `county`, `city`, or `continent`. If unspecified, defaults to `country code`.

**`location column`**\
Type: `text`\
Required: Yes\
The name of the column to contain the location type output.

## Outputs

**`data`**\
Type: `datatable`\
An object containing columns and rows.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`data:`

| id | latitude   | longitude  |
| -- | ---------- | ---------- |
| 1  | -13.163068 | -72.545128 |
| 2  | 37.4396    | -122.1864  |
| 3  | 51.50643   | -0.12719   |
| 4  | 51.50108   | -0.12459   |

`latitude column:` latitude

`longitude column:` longitude

`location type:` *null (empty)*

`location column:` address

#### Outputs:

`data`:

| id | latitude   | longitude  | address |
| -- | ---------- | ---------- | ------- |
| 1  | -13.163068 | -72.545128 | PE      |
| 2  | 37.4396    | -122.1864  | US      |
| 3  | 51.50643   | -0.12719   | GB      |
| 4  | 51.50108   | -0.12459   | GB      |

-> Converted the latitude and longitude from the `latitude` and `longitude` columns into the `country code` in the `address` column.


---

# 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://cgps.gitbook.io/data-flo/reference-guide/reverse-geocoding.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.
