Placekey 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 or in the Spatial Indexes section of this documentation.
PLACEKEY_FROMH3
Copy PLACEKEY_FROMH3(h3index)
Description
Returns the placekey equivalent of the given H3 index.
h3index
: STRING
H3 identifier.
Return type
STRING
Example
carto-un carto-un-eu manual
Copy SELECT `carto-un` .carto.PLACEKEY_FROMH3( '84390cbffffffff' );
-- @7dd-dc3-52k
Copy SELECT `carto-un-eu` .carto.PLACEKEY_FROMH3( '84390cbffffffff' );
-- @7dd-dc3-52k
Copy SELECT carto.PLACEKEY_FROMH3( '84390cbffffffff' );
-- @7dd-dc3-52k
PLACEKEY_ISVALID
Copy PLACEKEY_ISVALID(placekey)
Description
Returns a boolean value true
when the given string represents a valid Placekey, false
otherwise.
placekey
: STRING
Placekey identifier.
Return type
BOOLEAN
Examples
carto-un carto-un-eu manual
Copy SELECT `carto-un` .carto.PLACEKEY_ISVALID( '@7dd-dc3-52k' );
-- true
Copy SELECT `carto-un-eu` .carto.PLACEKEY_ISVALID( '@7dd-dc3-52k' );
-- true
Copy SELECT carto.PLACEKEY_ISVALID( '@7dd-dc3-52k' );
-- true
carto-un carto-un-eu manual
Copy SELECT `carto-un` .carto.PLACEKEY_ISVALID( '7dd-dc3-52k' );
-- true
Copy SELECT `carto-un-eu` .carto.PLACEKEY_ISVALID( '7dd-dc3-52k' );
-- true
Copy SELECT carto.PLACEKEY_ISVALID( '7dd-dc3-52k' );
-- true
carto-un carto-un-eu manual
Copy SELECT `carto-un` .carto.PLACEKEY_ISVALID( 'x' );
-- false
Copy SELECT `carto-un-eu` .carto.PLACEKEY_ISVALID( 'x' );
-- false
Copy SELECT carto.PLACEKEY_ISVALID( 'x' );
-- false
PLACEKEY_TOH3
Copy PLACEKEY_TOH3(placekey)
Description
Returns the H3 index equivalent of the given placekey.
placekey
: STRING
Placekey identifier.
Return type
STRING
Example
carto-un carto-un-eu manual
Copy SELECT `carto-un` .carto.PLACEKEY_TOH3( '@7dd-dc3-52k' );
-- 8a390cbffffffff
Copy SELECT `carto-un-eu` .carto.PLACEKEY_TOH3( '@7dd-dc3-52k' );
-- 8a390cbffffffff
Copy SELECT carto.PLACEKEY_TOH3( '@7dd-dc3-52k' );
-- 8a390cbffffffff
Last updated 3 months ago