# placekey

[Placekey](https://www.placekey.io/faq) is a free and open universal standard identifier for any physical place, so that the data pertaining to those places can be shared across organizations easily. Since Placekey is based on H3, here we offer a way to transform to and from that index and delegate any extra functionality to H3 itself.

You can learn more about Placekey on [their website](https://www.placekey.io/) or in the [Spatial Indexes section](https://docs.carto.com/data-and-analysis/analytics-toolbox-for-redshift/key-concepts/spatial-indexes#placekey) of this documentation.

## PLACEKEY\_ASH3 <a href="#placekey_ash3" id="placekey_ash3"></a>

```sql
PLACEKEY_ASH3(placekey)
```

**Description**

Returns the H3 index equivalent to the given placekey.

**Input parameters**

* `placekey`: `VARCHAR` Placekey identifier.

**Return type**

`VARCHAR`

**Example**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.PLACEKEY_ASH3('@7dd-dc3-52k');
-- 8a390cbffffffff
```

{% endcode %}

## PLACEKEY\_FROMH3 <a href="#placekey_fromh3" id="placekey_fromh3"></a>

```sql
PLACEKEY_FROMH3(h3index)
```

**Description**

Returns the Placekey equivalent to the given H3 index.

**Input parameters**

* `h3index`: `VARCHAR` H3 identifier.

**Return type**

`VARCHAR`

**Example**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.PLACEKEY_FROMH3('84390cbffffffff');
-- @7dd-dc3-52k
```

{% endcode %}

## PLACEKEY\_ISVALID <a href="#placekey_isvalid" id="placekey_isvalid"></a>

```sql
PLACEKEY_ISVALID(placekey)
```

**Description**

Returns a boolean value `true` when the given string represents a valid Placekey, `false` otherwise.

**Input parameters**

* `placekey`: `VARCHAR` Placekey identifier.

**Return type**

`BOOLEAN`

**Examples**

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.PLACEKEY_ISVALID('@7dd-dc3-52k');
-- TRUE
```

{% endcode %}

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.PLACEKEY_ISVALID('7dd-dc3-52k');
-- TRUE
```

{% endcode %}

{% code overflow="wrap" lineNumbers="true" %}

```sql
SELECT carto.PLACEKEY_ISVALID('x');
-- FALSE
```

{% endcode %}
