User:Bk/MapCSS
Zoom
Example:
wayz11[highway] { width: 1 }
wayz1214[highway] { width: 2; }
wayz15[highway] { width: 4; }
wayz16[highway] { width: 6; }
There are at least 2 interpretations:
Tile interpretation
You have slippy map (TMS) zoom levels like for the map on openstreetmap.org. Each number in the zoom selector simply corresponds to the tiles at that zoom level.
Scale interpretation
You consider the map scale (in pixel per meter) and define one particular scale C as zoom level 0. You get the other zoom levels by multiplying by 2. For this method, the projection does not matter and you can have continuous zoom.
Each zoom selector corresponds to a scalerange, so the rule is only applied, when the current scale is within this range.
s  current scale in pixel per meter
zoom2scale(z) = C * pow(2, z)
 function that converts zoom to scale value (with some constant C)

zX
applies, whens < zoom2scale(X + 0.5)

zXY
applies, whenzoom2scale(X  0.5) < s < zoom2scale(Y + 0.5)

zX
applies, whenzoom2scale(X  0.5) < s < zoom2scale(X + 0.5)

zX
applies, whenzoom2scale(X  0.5) < s
So what is the value of the base scale C?
One way to choose it, is to make sure that in Mercatorprojection, the slippy map scale is for the most part of the earth surface within the range [zoom2scale(Z  0.5), zoom2scale(Z + 0.5)]. This way, both definitions (tile and scale) coincide.
The slippy map scale is given as 256 / (2 * Pi * 6378137) * pow(2, z) / cos(lat)
So setting
C = sqrt(2) * 256 / (2 * Pi * 6378137)
both interpretations are the same for latitudes from 60° to 60°. This is the best you can do.
Summary: zXY
applies, when the scale is greater than 256 / (2 * Pi * 6378137) * pow(2, X) and lower than 256 / (2 * Pi * 6378137) * pow(2, Y + 1).
Comments
As a consequence of the projection (Mercator, EPSG:3857), tiles in Oslo (ca. 60 deg N) have twice the scale as tiles of the same level at the equator. The choice, when to render a particular feature, should depend on the map scale only and not on some artificial distortion factor introduced by the projection.
This principle is also respected by Mapnik: Allthough it creates tiles (in the end), the zoom values in the style file do not correspond to tile levels, but will get converted to scalebounds. Bk 13:10, 1 May 2012 (BST)