Constructs a new immutable instance of a TileKey
.
For the better readability, TileKey.fromRowColumnLevel should be preferred.
Note - row and column must not be greater than the maximum rows/columns for the given level.
Represents the row in the quadtree.
Represents the column in the quadtree.
Represents the level in the quadtree.
Represents the column in the quadtree.
Represents the level in the quadtree.
Represents the row in the quadtree.
Returns the absolute quadkey that is constructed from its sub HERE tile key.
The sub HERE key.
The absolute tile key in the quadtree.
Returns the absolute quadkey that is constructed from its sub quadkey.
The sub key.
The absolute tile key in the quadtree.
Returns a new tile key at a level that differs from this tile's level by delta.
Equivalent to changedLevelTo(level() + delta)
.
Note - root key is returned if delta
is smaller than the level of this tile key.
The numeric difference between the current level and the requested level.
Returns a new tile key at the requested level.
If the requested level is smaller than the tile's level, then the key of an ancestor of this tile is returned. If the requested level is larger than the tile's level, then the key of first child or grandchild of this tile is returned, for example, the child with the lowest row and column number. If the requested level equals this tile's level, then the tile key itself is returned. If the requested level is negative, the root tile key is returned.
The requested level.
Returns the number of available columns in the tile's level.
This is 2 to the power of the level.
Equality operator.
The tile key to compare to.
true
if this tile key has identical row, column and level, false
otherwise.
Returns a sub quadkey that is relative to its parent.
This function can be used to generate sub keys that are relative to a parent that is delta levels up in the quadtree.
This function can be used to create shortened keys for quads on lower levels if the parent is known.
Note - the sub quadkeys fit in a 16-bit unsigned integer if the delta
is smaller than 8. If
delta
is smaller than 16, the sub quadkey fits into an unsigned 32-bit integer.
Deltas larger than 16 are not supported.
The number of levels relative to its parent quadkey. Must be greater or equal to 0 and smaller than 16.
The quadkey relative to its parent that is delta
levels up the tree.
Converts the tile key to a numeric code representation.
You can create a tile key from a numeric Morton code with fromMortonCode.
Note - only levels <= 26 are supported.
Returns a tile key representing the parent of the tile addressed by this tile key.
Throws an exception is this tile is already the root.
Returns the number of available rows in the tile's level.
This is 2 to the power of the level.
Converts the tile key into a string for using in REST API calls.
The string is a quadkey Morton code representation as a string.
You can convert back from a quadkey string with fromHereTile.
Converts the tile key into a string for using in REST API calls.
If the tile is the root tile, the quadkey is '-'. Otherwise the string is a number to the base of 4, but without the leading 1, with the following properties:
You can convert back from a quadkey string with fromQuadKey.
Returns the closest matching TileKey
in a cartesian coordinate system.
The level for the tile key.
The X coordinate.
The Y coordinate.
The maximum X coordinate.
The maximum Y coordinate.
A new tile key at the given level that includes the given coordinates.
Returns the number of available columns at a given level.
This is 2 to the power of the level.
The level for which to return the number of columns.
The available columns at the given level.
Creates a tile key from a heretile code string.
The string can be created with toHereTile.
The string representation of the HERE tile key.
A new instance of TileKey
.
Creates a tile key from a numeric Morton code representation.
You can convert a tile key into a numeric Morton code with mortonCode.
The Morton code to be converted.
A new instance of TileKey.
Creates a tile key.
The requested row. Must be less than 2 to the power of level.
The requested column. Must be less than 2 to the power of level.
The requested level.
Computes the Morton code of the parent tile key of the given Morton code.
Note: The parent key of the root key is the root key itself.
A Morton code, for example, obtained from mortonCode.
The Morton code of the parent tile.
Returns the number of available rows at a given level.
This is 2 to the power of the level.
The level for which to return the number of rows.
The available rows at the given level.
Generated using TypeDoc
The
TileKey
instances are used to address a tile in a quadtree.A tile key is defined by a row, a column, and a level. The tree has a root at level 0, with one single tile. On every level, each tile is divided into four children (therefore the name quadtree).
Within each level, any particular tile is addressed with row and column. The number of rows and columns in each level is 2 to the power of the level. This means: On level 0, only one tile exists, columnsAtLevel() and rowsAtLevel() are both 1. On level 1, 4 tiles exist, in 2 rows and 2 columns. On level 2 we have 16 tiles, in 4 rows and 4 columns. And so on.
A tile key is usually created using fromRowColumnLevel() method.
TileKey
instances are immutable, all members return new instances ofTileKey
and do not modify the original object.Utility functions like parent(), changedLevelBy(), and changedLevelTo() allow for easy vertical navigation of the tree. The number of available rows and columns in the tile's level is given with rowCount() and columnCount().
Tile keys can be created from and converted into various alternative formats:
Note - as JavaScript's number type can hold 53 bits in its mantissa, only levels up to 26 can be represented in the number representation returned by mortonCode().