HEREtile map tiling scheme
The HEREtile map tiling scheme uses quadtrees, in which each higher level of detail splits parent tiles into four equal child tiles. The quadtree scheme numbers child tiles 0 through 3 as follows:
In this figure:
- Tile 0 is the southwest sub-tile
- Tile 1 is the southeast sub-tile
- Tile 2 is the northwest sub-tile
- Tile 3 is the northeastern sub-tile
This example shows raw, non-projected WGS84 latitude/longitude coordinates, so each child tile covers half its parent's latitude/longitude range per side.
Special root tile
To avoid special handling of level 1 tiles, the level 0 root tile representing the entire world and a virtual counterpart.
The familiar -180° to +180° longitude and -90° to +90° latitude range of the world includes a virtual counterpart north of the North Pole. This results in a base coordinate range of -180° to +180° longitude and -90° to +270° latitude, making the level 0 world tile a square with sides of 360°.
From here the root world tile splits into child tiles in the standard way to form four tiles at level 1, resulting in tiles 0 and 1 covering the known world and tiles 2 and 3 covering the virtual counterpart.
If a location is on the border between two tiles, the locations lying on the southwest border of a tile belong to that tile in the HEREtile scheme.
More special cases:
- Longitude values of +180° transform to -180° so tile references "wrap" over the anti-meridian.
- Latitude values of +90° cover southern tiles.
Calculating tile sizes
This tiling scheme leads to the following formula:
-
Calculate the latitude and longitude range for one tile at a given tile level:
360° / 2^(tile level) = degrees of latitude and longitude per tile.
For level 14 tiles:360° / 2^14 = 360° / 16384 = 0.02197265625° per tile.
-
Next, calculate the horizontal distance of a tile in meters, measured along the parallel at a given latitude:
S_tile = C · cos(latitude) / 2^(tile level)
…where C stands for the equatorial circumference of the Earth:
40 075 016.686 m ≈ 2π · 6 378 137.000 m. -
As tiles are 256 pixels wide, calculate the horizontal distance of one tile pixel, in a level‑14 tile:
S_pixel = S_tile / 256 = C · cos(latitude) / 2^(tile level + 8)
For example, on the equator and at zoom level 0, the result is:
40 075 016.686 / 256 ≈ 156 543.03 meters per pixel.
This formula assumes that the Earth is a perfect sphere, but the Earth is actually a geoid. The error in these spherical calculations is small.
HEREtile identifiers
HEREtile tile identifiers (tile IDs) use a packed binary representation, generally stored as values. To calculate a tile ID for location on the earth, based on its latitude and longitude coordinates, first convert the coordinates to a tile quadkey. They convert the quadkey to a packed HEREtile ID.
Tile quadkeys
Tile quadkeys are strings of tile numbers (0-3) which capture the hierarchy of parent-child tiles from level 1 to the target tile level.
Hence, for the level 5 tile containing San Francisco, the logical quadkey is "02123":
It follows that the "level" of a tile quadkey can be directly inferred from the number of digits in the value. So a level 14 tile quadkey has 14 digits, using only 0, 1, 2, and 3 in base 4.
Calculate tile quadkeys
You can convert latitude/longitude coordinates to a tile quadkey at a given tile level, using the following equations. Tile quadkeys use a version of Morton coding. Once you have a tile quadkey for a location on the earth, you can convert it to a tile ID.
You can convert a tile quadkey to lat/long coordinates by reversing this process. To calculate a level 14 tile quadkey for the Berlin Hauptbahnhof central train station at lat/long coordinates 52.52507/13.36937 degrees, follow these steps:
-
Calculate the desired tile's (X,Y) indexes on the world map by plugging values into the following algorithms. Tile indexes aren't latitude/longitude values. They're the tile's integral positional coordinates, indexed from (0,0) in the southwest corner of the world map.
a. Determine the horizontal (X) tile, indexed from the longitude value, by dividing the longitude range (-180° to +180°) of the world map into tile-sized ranges based on the desired zoom level. Per the Special Root Tile, each level 14 tile cover 0.02197265625 degrees per tile:
180° + 13.36937° = 193.36937° absolute longitude offset from southwest corner. 193.36937° / 0.02197265625° = 8,800.45 = tile X: 8,800 (round down for 0-based indexing)
b. Calculate the vertical (Y) tile index, making sure to use the special -90° to +270° latitude range:
90° + 52.52507° = 142.52507° absolute latitude from the south-west corner. 142.52507° / 0.02197265625° = 6,486.47 = tile Y: 6,486 (round down for 0-based indexing)
-
Convert the tile (X, Y) indexes (8800, 6486) at tile level 14 into a Morton code quadkey:
a. Take the simple binary representation of the tile coordinate indexes, zero-padded to the "tile level" number of bits:
tile X coordinate: 8800 = 100010011000002 - already 14 bits tile Y coordinate: 6486 = 011001010101102 - zero-padded to 14 bits
b. Interleave the bits of the binary values, starting with the first bit of the Y-coordinate:
interleaved Y/X = 01101000011000110110001010002
c. Interpret the resulting binary value as a base 4 integer to get the quadkey string:
01101000011000110110001010002 = 122012031202204 = quadkey string "12201203120220"
The result is a quadkey with the same number of digits as the desired tile level, containing only the digits 0-3. Here is the level 14 tile quadkey for the central train station in Berlin: 12201203120220
- The next step is to encode the tile's logical quadkey as a HEREtile ID by using the procedure in the following section.
Convert a tile logical quadkey to HEREtile ID binary encoding
To convert a tile quadkey string into a packed HEREtile ID, follow these steps:
-
Preface the quadkey with a "1" followed by the quadkey
12201203120220:112201203120220 -
Parse an integer value from the resulting string using base‑4 radix and convert to base‑10 radix:
112201203120220₄=377894440₁₀= HEREtile encoded Tile ID: 377894440
This results in a compact binary encoding, when tile IDs up to level 15 stores as a 32-bit unsigned integer, and up to level 30 in 64-bit unsigned integer values. In most HERE map products, published tiles are level 14, so tile IDs are all published as values. The following figure provides an example of map content for that tile:
You can convert a tile ID to a quadkey by reversing this process.
Updated last month