How Tile Height Is Calculated

The tile height is calculated from the map bounds and the tile width to produce a tile that has the same aspect ratio as the bounds.

The tile height is calculated using the following equation:

tileHeight = (boundsHeight ÷ boundsWidth) × tileWidth

There is one restriction when defining a map: the resultant tile height must be a whole number (integer). Since tile height and tile width are calculated in pixels, it is impossible for a user to display these values as fractions of a pixel.

For example, a map with a bounds of (-180, -90, 180, 90) in WGS84 has an aspect ratio (width to height) of 2:1. So the tileHeight calculation is half the tileWidth. If you defined the tileWidth parameter to be 256 then the tileHeight would be 128. This is an acceptable tileHeight value. However, if you have defined a map with the bounds of (-180, -90, 90, 0) in WGS84, that would create an aspect ratio of 3:1. Calculating the tileHeight based on a tileWidth of 256 would result in a tileHeight of 85.3333333. This is not an acceptable tileHeight value, and will not be displayed by the Map Tiling Service. If a map hosted by the Map Tiling Service is configured with tileWidth and bounds parameter settings that result in an invalid tileHeight calculation, then the map will not appear in the list of available maps returned by a call to the getMaps method in the Map Tiling Interface.