# ＊ MetroAreaAnonymizer

{% 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 `MetroAreaAnonymizer` performs Contextual Anonymization on GPS coordinates. It preserves the broad regions in your original data, while anonymizing the precise location. It transforms the data by extracting the postal code that corresponds to the GPS coordinate. When reverse transforming, it generates new GPS coordinates within the correct postal codes.

<figure><img src="https://2225246359-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVGX92M819eIp0rMg5elc%2Fuploads%2FvDh4aDvlUN7ami3l9rC4%2Frdt_transformers-glossary-deep-data-understanding-gps-coordinates-metro-area-anonymizer_June%2002%202025.png?alt=media&#x26;token=d22b8c6b-3b4a-43b8-a600-bd933c5e5624" alt=""><figcaption></figcaption></figure>

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

transformer = MetroAreaAnonymizer()
```

{% hint style="danger" %}
***This transformer is still in Beta!*** We have not yet optimized the performance or quality. Please contact us if you notice any issues.

Due to the nature of postal code information, this transformer is **optimized for dense, metropolitan areas such as cities**. If you use this transformer for rural areas, the level of anonymization may not be enough for your needs. In such cases, we recommend using the [GPSNoiser](https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/gps-coordinates/gpsnoiser) or [RandomLocationGenerator](https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/gps-coordinates/randomlocationgenerator).
{% endhint %}

## Parameters

No parameters are available for this transformer.&#x20;

## 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 MetroAreaAnonymizer

transformer = MetroAreaAnonymizer()

# 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>What happens to missing values?</summary>

This transformer recreates missing GPS coordinates during the reverse transform phase in the same proportion as the original data.

Note that a GPS coordinate is considered *missing* if either the latitude or longitude are null.

</details>

*Worldwide, regional data is provided by* [*www.geonames.org*](https://www.geonames.org)*.*
