Map Tile API Developer's Guide

Key Concepts

This section provides insights into the key concepts used throughout the Map Tile API.

Map Tile Resources and URL usage

The Map Tile API uses different URLs to provide different map tiles, depending on the specific use case that needs to be solved.

Each Map Tile Resource is mapped to a different URL, see Constructing a Request for more details on how to construct a request.

Each Map Tile Resource provides a different set of possible combinations of tile types , schemes and parameters in order to show different images.
  • Base: provides map tiles using the map as a background, metadata text-based tiles with information about the map and base64 encoded tiles.
  • Aerial: provides map tiles using satellite images as a background
  • Pano: provides map tiles using map and panorama coverage as a background
  • Traffic: provides map tiles with a traffic flow overlay

Information Request Usage

The Map Tile API offers regularly updated maps. In order to know how to get the latest available map and how to properly use that information, please check Requesting the Right Map Version

Copyright Request Usage

The Map Tile API offers copyright information about the map that you need to include when displaying a map composed out of map tiles. Please note that every resource offers its own copyright information that you should query.

The Mercator Projection

The Map Tile API serves map tiles obtained by mapping points on the surface of a sphere (the globe) to points on a plane, using the normalized Mercator projection.

The basic Mercator projection formula is this:

{λ, φ} -> x[-1, 1] y [-1, 1]

In this formula:

λ = longitude
φ = latitude
x = λ / π
y = ln(tan(π/4 + φ/2)) / π

The plane represents the globe as a square grid of map tiles. The size of the grid depends on the map zoom level. At the lowest zoom level, the world is contained in one map tile. At the next higher zoom level, the world is two tiles wide and two tiles high (2x2), at the next level above that, the grid is 4x4, then 8x8, 16x16, and so on up to the maximum zoom for a particular region. In other words, at each zoom level the tiles that make up the complete map of the world form a grid in which the number of tiles is equal to two to the power of two multiplied by the zoom level (2(2*zoom)).

The relationship between tiles at two consecutive zoom levels can be expressed as follows:

col1,z+1 = (2*colz) + 1row1,z+1 = (2*rowz) + 1

In this formula:

col = column number in the tile grid
row = row number in the tile grid
z = zoom level

The diagram below demonstrates this graphically:

Figure 1. Tiles at different zoom levels
You can use this information to obtain the grid coordinates (row and column) of the map tile for a particular geographic location in your application. The following pseudo code contains the complete algorithm:
--- javascript ---
var lat = 52.525439, // Latitude
lon = 13.38727,    // Longitude
z = 12,        // Zoom level

latRad = lat * Math.PI / 180;
n = Math.pow(2, z);
xTile = n * ((lon + 180) / 360);
yTile = n * (1-(Math.log(Math.tan(latRad) + 1/Math.cos(latRad)) /Math.PI)) / 2;

--- output ---
lat_rad = 0.916
n = 4096
xTile = 2200.31 // Column
yTile = 1343.20 // Row

The zoom level and tile row and column can be used as URL variables separated by the '/' character in map tile requests. Note that they must be provided in this order: zoom/column/row. This is the [Z]/[X]/[Y] addressing scheme.

The map tile specification is typically preceded by other path variables and may be followed either by further path variables and/or query parameters.

Using a Tile Address

A request that includes a tile address in the format zoom/column/row can be formulated as follows:

In this case, the request obtains a map tile at zoom level 12 for part of Berlin, Germany:

Figure 2. A map tile for part of Berlin