> For the complete documentation index, see [llms.txt](https://docs.sdv.dev/rdt/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/gps-coordinates/randomlocationgenerator.md).

# ＊ RandomLocationGenerator

{% hint style="info" %}
**＊SDV Enterprise Feature.** This feature is available to our licensed users and is not currently in our public library. For more information, visit our page to [Explore SDV](https://docs.sdv.dev/sdv/explore/sdv-enterprise/compare-features).
{% endhint %}

The `RandomLocationGenerator` creates realistic GPS coordinates from a list of countries. It transforms the real data by dropping all the GPS-related columns. Then when reverse transforming, it generates random, realistic coordinates from around the world. Use this transformer when you want to completely anonymize your coordinates.

<figure><img src="https://2225246359-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVGX92M819eIp0rMg5elc%2Fuploads%2FWozHTGnWKGFntiV45WxO%2Frdt_transformers-glossary-deep-data-understanding-gps-coordinates-random-location-generator_June%2002%202025.png?alt=media&amp;token=58c5a7a2-171c-4161-94ae-eae1828ca4ba" alt=""><figcaption></figcaption></figure>

```python
from rdt.transformers.gps import RandomLocationGenerator

transformer = RandomLocationGenerator(
    locales=['en_US', 'fr_CA'],
    missing_value_generation='random')
```

## Parameters

**`locales`**: An optional list of locales to use when generating GPS coordinates. All coordinates will be chosen from the list of available countries

<table data-header-hidden><thead><tr><th width="211.5"></th><th></th></tr></thead><tbody><tr><td>(default) <code>["en_US"]</code></td><td>Create locations from the US</td></tr><tr><td><code>&#x3C;list></code></td><td>Create data from the list of countries specified <br><br>For example <code>[</code><a href="https://faker.readthedocs.io/en/master/locales/en_US.html"><code>"en_US"</code></a><code>,</code> <a href="https://faker.readthedocs.io/en/master/locales/fr_CA.html"><code>"fr_CA"</code></a><code>]</code> creates a mix of locations from the US and from Canada.</td></tr></tbody></table>

**`missing_value_generation`**: Add this argument to determine how to recreate missing values during the reverse transform phase

<table data-header-hidden><thead><tr><th width="203"></th><th></th></tr></thead><tbody><tr><td>(default) <code>'random'</code></td><td>Randomly assign missing values in roughly the same proportion as the original data.</td></tr><tr><td><code>None</code></td><td>Do not recreate missing values.</td></tr></tbody></table>

## Examples

{% hint style="info" %}
**This transformer takes exactly 2 columns as input.** Make sure that you have 1 column with sdtype `latitude` and 1 column with sdtype `longitude`.
{% endhint %}

```python
from rdt.transformers.gps import RandomLocationGenerator

transformer = RandomLocationGenerator(
    locales=['en_US', 'fr_CA'],
    missing_value_generation='random'
)

# in the hypertransformer, ensure that each column has a supported sdtype
ht.update_sdtypes(column_name_to_sdtype={
    'user_lat': 'latitude',
    'user_lon': 'longitude',
})

# in the hypertransformer, assign set of columns to your transformer
ht.update_transformers(column_name_to_transformer={
    ('user_lat', 'user_lon'): transformer
})
```

## FAQs

<details>

<summary>Can I limit the regions to the ones in my original data?</summary>

This transformer is designed to create random coordinates from anywhere in the countries that you provide. For example, if you provide `'en_US'`, then the transformer will create GPS coordinates from anywhere in the US such as California, New York, Massachusetts, etc. -- even if your original data did not have all these locations.

If you'd like to limit the regions based on the original data, use the [GPSNoiser](/rdt/transformers-glossary/deep-data-understanding/gps-coordinates/gpsnoiser.md) or [MetroAreaAnonymizer](/rdt/transformers-glossary/deep-data-understanding/gps-coordinates/metroareaanonymizer.md).

</details>

*Worldwide, regional data is provided by* [*www.geonames.org*](https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/gps-coordinates/www.geonames.org)*.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/gps-coordinates/randomlocationgenerator.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
