MinScaleDenominator

From OpenStreetMap Wiki
Jump to navigation Jump to search

In a Mapnik XML Stylesheet the MinScaleDenominator indicates the minimum map scale at which a symbol or feature should be rendered.

One inch to the mile maps have a scale of 1:63,360, so setting MinScaleDenominator to be 63360 would mean that the symbol or feature would only appear when you render at a scale showing more detail than 1 inch to the mile.

Working out the map scale is a bit tricky. If you are rendering an area of 5,000 * 5,000 Spherical Mercator co-ordinates (ie. 5km * 5km) into a 1024 * 1024 pixel image then your map scale will be about 5m/pixel. Each pixel is assumed to be 0.28mm on your computer screen, so the scale value for your map would then be 5,000 mm / 0.28 mm which is approximately 18000.

Below is a table which shows the relation between zoomlevel and scale and which may help to see at which zoomlevel a feature is rendered or not:

Zoomlevel Scale
0 559.082.264
1 279.541.132
2 139.770.566
3 69.885.283
4 34.942.642
5 17.471.321
6 8.735.660
7 4.367.830
8 2.183.915
9 1.091.958
10 545.979
11 272.989
12 136.495
13 68.247
14 34.124
15 17.062
16 8.531
17 4.265
18 2.133
19 1.066
20 533

Example: If you set MaxScaleDenominator inside of a style-file (eg. osm.xml) for a feature to 18.000 (without setting a MinScaleDenominator) this feature will be rendered on all tiles for zoomlevel 15 and higher.

If you want to know more about map scales, look at this link: ScaleAndPpi.