Skip to content

Documentation / @interstellar-tools/maps / fromQuadkey

Function: fromQuadkey() ​

ts
function fromQuadkey(key: string): TileInterface;

Defined in: tiles/quadkey.ts:81

Find the web map tile named by a quadkey: the inverse of quadkey.

Units

  • Input: a string of digits 0–3, one per zoom level.
  • Output: { x, y, z }, integer tile indices, with z the key's length.

Notes

  • Each digit adds one bit to the column (1 or 3) and the row (2 or 3).
  • The empty key '' is the single tile at zoom 0.

Parameters ​

ParameterTypeDescription
keystringThe quadkey: at most 30 digits 0–3.

Returns ​

TileInterface

The tile, { x, y, z }.

Throws ​

If key holds anything but the digits 0–3, or more than 30 of them.

Example ​

ts
fromQuadkey('213'); // { x: 3, y: 5, z: 3 }

See ​