---
id: "s2_cell_token"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["geo"]
langs: ["common"]
quality: 68
url: "http://registry.apicrafter.io/datatype/s2_cell_token"
---

# S2 cell token (`s2_cell_token`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Token of a cell of the S2 Geometry library, which projects the sphere onto the six faces of a cube and divides each face into a hierarchy of cells along a Hilbert curve. The token is the 64-bit cell id in lowercase hexadecimal with the trailing zeros removed, so larger cells have shorter tokens, up to 16 characters. The top three bits hold the cube face (0 to 5), so a token begins with 0-9, a or b and does not end in 0; the id 0 is written X. The regexp only checks this shape, so it also matches other short hexadecimal strings.

- Personal data (PII): no
- Categories: Geographic identifiers (geo)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(?:[1-9ab]|[0-9ab][0-9a-f]{0,14}[1-9a-f])$
```

## Examples

- `89c25` — Token used in the S2 library tests
- `X` (invalid example) — Token of the invalid cell id 0
- `89c250` (invalid example) — Trailing zeros are removed

## Sources

- doc: <http://s2geometry.io/devguide/s2cell_hierarchy>
- doc: <https://github.com/google/s2geometry/blob/master/src/s2/s2cell_id.h>

## Quality

Score 68/100. Missing: second example, mapping (Wikidata, Schema.org, ...), translation, detector coverage.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/s2_cell_token.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/geo/s2_cell_token.yaml>
