<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On 10 Jul 2007, at 21:52, Andy Allan wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi All,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Does anyone have a conversion scale for google zoom <=> mapnik</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">maxScaleDenominator? I'm making a slippy map, and when I want to make</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">something appear on e.g. zoom 7 I'm hunting around looking for the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">correct values.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I guess you're after these numbers (zoom level  - scale denominator)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>1 279541132.014</DIV><DIV>2 139770566.007</DIV><DIV>3 69885283.0036</DIV><DIV>4 34942641.5018</DIV><DIV>5 17471320.7509</DIV><DIV>6 8735660.37545</DIV><DIV>7 4367830.18772</DIV><DIV>8 2183915.09386</DIV><DIV>9 1091957.54693</DIV><DIV>10 545978.773466</DIV><DIV>11 272989.386733</DIV><DIV>12 136494.693366</DIV><DIV>13 68247.3466832</DIV><DIV>14 34123.6733416</DIV><DIV>15 17061.8366708</DIV><DIV>16 8530.91833539</DIV><DIV>17 4265.4591677</DIV><DIV>18 2132.72958385</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here is modified generate_tiles.py to generate_scales instead. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>from math import pi,cos,sin,log,exp,atan</DIV><DIV>import sys, os</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>DEG_TO_RAD = pi/180</DIV><DIV>RAD_TO_DEG = 180/pi</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>def minmax (a,b,c):</DIV><DIV>    a = max(a,b)</DIV><DIV>    a = min(a,c)</DIV><DIV>    return a</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>class GoogleProjection:</DIV><DIV>    def __init__(self,levels=18):</DIV><DIV>        self.Bc = []</DIV><DIV>        self.Cc = []</DIV><DIV>        self.zc = []</DIV><DIV>        self.Ac = []</DIV><DIV>        c = 256</DIV><DIV>        for d in range(0,levels):</DIV><DIV>            e = c/2;</DIV><DIV>            self.Bc.append(c/360.0)</DIV><DIV>            self.Cc.append(c/(2 * pi))</DIV><DIV>            self.zc.append((e,e))</DIV><DIV>            self.Ac.append(c)</DIV><DIV>            c *= 2</DIV><DIV>                </DIV><DIV>    def fromLLtoPixel(self,ll,zoom):</DIV><DIV>         d = self.zc[zoom]</DIV><DIV>         e = round(d[0] + ll[0] * self.Bc[zoom])</DIV><DIV>         f = minmax(sin(DEG_TO_RAD * ll[1]),-0.9999,0.9999)</DIV><DIV>         g = round(d[1] + 0.5*log((1+f)/(1-f))*-self.Cc[zoom])</DIV><DIV>         return (e,g)</DIV><DIV>     </DIV><DIV>    def fromPixelToLL(self,px,zoom):</DIV><DIV>         e = self.zc[zoom]</DIV><DIV>         f = (px[0] - e[0])/self.Bc[zoom]</DIV><DIV>         g = (px[1] - e[1])/-self.Cc[zoom]</DIV><DIV>         h = RAD_TO_DEG * ( 2 * atan(exp(g)) - 0.5 * pi)</DIV><DIV>         return (f,h)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>from mapnik import *</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>def generate_scales(minZoom=1,maxZoom=18):</DIV><DIV>    gprj = GoogleProjection(maxZoom+1) </DIV><DIV>    m = Map(256,256)</DIV><DIV>    prj = Projection("+proj=merc +datum=WGS84")</DIV><DIV>    </DIV><DIV>    for z in range(minZoom,maxZoom + 1):</DIV><DIV>        p0 = gprj.fromPixelToLL( (0,0),z)</DIV><DIV>        p1 = gprj.fromPixelToLL( (256,256),z)</DIV><DIV>        c0 = prj.forward(Coord(p0[0],p0[1]))</DIV><DIV>        c1 = prj.forward(Coord(p1[0],p1[1]))</DIV><DIV>        bbox = Envelope(c0.x,c0.y,c1.x,c1.y)</DIV><DIV>        m.zoom_to_box(bbox)</DIV><DIV>        print z,scale_denominator(m,False)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>if __name__ == "__main__":</DIV><DIV>    generate_scales(1, 18)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Also, has anyone got experience of the shieldsymbolizer (used for road</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">references)? I'm trying to space out the shields so that you can see</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">the road below them - when the ways are short and the zoom is low,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">there's practically no gap between the shields. I'd ideally like to</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">control the spacing between shields with equal values, but increasing</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">the gap between all shields would otherwise be nice.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>There is 'minimum_distance' property in the latest trunk which I haven't tried, yet : <A href="http://trac.mapnik.org/changeset/490">http://trac.mapnik.org/changeset/490</A></DIV><DIV>It should do the trick. Let me know if it works for you.</DIV><DIV> <BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Cheers,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Andy</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV>Cheers,</DIV><DIV>Artem</DIV><DIV><BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">dev mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:dev@openstreetmap.org">dev@openstreetmap.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev">http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Artem Pavlenko</DIV><DIV><A href="http://mapnik.org">http://mapnik.org</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>