When using a Mercator Projection on a tile-based system, it is better to talk about how many meters a pixel represents rather than to calculate the scale of the map at a certain zoom level.
Note that due to the limitations of Mercator Projection, the ordinate y becomes infinite at the poles, and the map must be truncated at some latitude less than ninety degrees. This needs to be done symmetrically. Our map is truncated at 80ºN and 66ºS with the result that European countries are moved towards the center of the map.
For example, at zoom level 0 where the whole world consists of a single tile 256 pixels wide, we can calculate meters by pixel (m/px) using an Earth radius of 6372.7982km as 156,412. That would yield an approximated scale of 1:500 Mill. (taking the scale as an approximate size comparison referring to distances on the equator). As the map scale will depend on the monitor, we have used a monitor with a 0.3 mm / pixel.
Below is a table with approximated values for the zoom level correspondence to scale.
|zoom level||scale (m/pixel)|
Nevertheless, you can also use a formula to calculate the meters per pixel for 256 pixel tiles. The distance represented by one pixel (S) is given by:
C is the equatorial circumference of the Earth,
z is the zoom level,
y is the latitude of the requested point in degrees.
Since the Earth is actually ellipsoidal, there will be a slight error in this calculation (0.3% maximum).