# User:Bk/MapCSS

## Zoom

Example:

```way|z-11[highway] { width: 1 }
way|z12-14[highway] { width: 2; }
way|z15[highway] { width: 4; }
way|z16-[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 scale-range, 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)

• `|z-X` applies, when `s < zoom2scale(X + 0.5)`
• `|zX-Y` applies, when `zoom2scale(X - 0.5) < s < zoom2scale(Y + 0.5)`
• `|zX` applies, when `zoom2scale(X - 0.5) < s < zoom2scale(X + 0.5)`
• `|zX-` applies, when `zoom2scale(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 Mercator-projection, 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: `|zX-Y` 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).