[OSM-dev] Units in the Mapnik .xml file?

Tom Hughes tom at compton.nu
Thu Nov 1 10:04:17 GMT 2007


In message <OF97880B8E.7C3680BD-ON80257386.00356CD8-80257386.00358A43 at solent-university.ac.uk>
        Nick Whitelegg <Nick.Whitelegg at solent.ac.uk> wrote:

> Can anyone clarify what units the <MaxScaleDenominator> parameters in 
> mapnik xml files are? How can I work them out from OSM-style Mercator 
> units, or lat/lon for that matter? Would like to (finally!) implement 
> different zoom levels on Freemap and that will be fairly crucial.

Did you mean to CC the OpenLayers list? Or were you after the Mapnik list?

Anyway, the answer is that they are more or less what you expect, if
you know what DPI mapnik is assuming. I actually did all the maths to
work it out - see the attached spreadsheet.

In summary though, this is what I came up with:

    Zoom    Scale           Min Scale       Max Scale

    1       279399417       200000000       500000000
    2       139699708       100000000       200000000
    3       69849854        50000000        100000000
    4       34924927        25000000        50000000
    5       17462464        12500000        25000000
    6       8731232         6500000         12500000
    7       4365616         3000000         6500000
    8       2182808         1500000         3000000
    9       1091404         750000          1500000
    10      545702          400000          750000
    11      272851          200000          400000
    12      136425          100000          200000
    13      68213           50000           100000
    14      34106           25000           50000
    15      17053           12500           25000
    16      8527            5000            12500
    17      4263            2500            5000
    18      2132            1000            2500

That shows the scale for each zoom, along with the values I normally
use for min/max scale if I want to match a particular zoom level.

So if I want to render something at zooms 8 to 12 then I take the min
scale value for z12 and max scale value for z8 and use those.

I keep meaning to write a preprocessor to allow us to use zoom levels
in the XML file and have them turned into scale values...

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: scales.ods
Type: application/vnd.oasis.opendocument.spreadsheet
Size: 13174 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071101/cc58029f/attachment.ods>


More information about the dev mailing list