<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Play with this:<br>
<br>
#!/usr/bin/python<br>
from math import pi,cos,sin,log,exp,atan,ceil,floor,radians,tan<br>
from subprocess import call<br>
import sys, os<br>
from Queue import Queue<br>
import mapnik<br>
import threading<br>
<br>
def deg2num(lat_deg, lon_deg, zoom):<br>
   lat_rad = radians(lat_deg)<br>
   n = 2.0 ** zoom<br>
   xtile = int((lon_deg + 180.0) / 360.0 * n)<br>
   ytile = int((1.0 - log(tan(lat_rad) + (1 / cos(lat_rad))) / pi) /
2.0 * n)<br>
   return(xtile, ytile)<br>
<br>
<br>
def minmax (a,b,c):<br>
    a = max(a,b)<br>
    a = min(a,c)<br>
    return a<br>
<br>
def dirty_tiles(bbox):<br>
    for z in range(5,18):<br>
        str_z = "%s" % z<br>
        px0 = deg2num(bbox[1], bbox[0], z)<br>
        px1 = deg2num(bbox[3], bbox[2], z)<br>
        #print px0, px1<br>
 <br>
        for x in range(int(px0[0]),int(px1[0])+1):<br>
            str_x = "%s" % x<br>
            for y in range(int(px0[1]),int(px1[1])+1):<br>
                str_y = "%s" % y<br>
                dirty_uri = 'curl <a class="moz-txt-link-freetext" href="http://b.tile.openstreetmap.org/">http://b.tile.openstreetmap.org/</a>' +
str_z + '/' + str_x + '/' + str_y + '.png/dirty; sleep 2;'<br>
                print dirty_uri<br>
<br>
<br>
if __name__ == "__main__":<br>
    home = "."<br>
   
#-------------------------------------------------------------------------<br>
    #<br>
    # Change the following for different bounding boxes and zoom levels<br>
    #<br>
    # Start with an overview<br>
<br>
#    if  sys.argv[0] is None:<br>
#        print "usage dirty.py: tilename max_lat max_lon min_lat
min_lon"<br>
#        exit<br>
<br>
<br>
    bbox =
(float(sys.argv[2]),float(sys.argv[3]),float(sys.argv[4]),float(sys.argv[5]))<br>
#    bbox = (-87.0,49.0,-82.0,45.0)<br>
#    bbox = (-81.0,52.0,-70.0,38.0)<br>
    print "#",sys.argv[1],":",bbox<br>
    <br>
    dirty_tiles(bbox)<br>
<br>
<br>
<br>
On 08/08/10 08:26 PM, Tyler Gunn wrote:
<blockquote cite="mid:8addf5cf9633934270767301aac2b44c@localhost"
 type="cite">
  <pre wrap="">
Is there any easy way to "dirty" large areas of the Mapnik map at all zoom
levels?  I'm working on the 062N* tiles in Canvec and there's a fair number
of tiles at different zoom levels that are not properly refreshed:

For example:
<a class="moz-txt-link-freetext" href="http://www.openstreetmap.org/?lat=51.529&lon=-100.42&zoom=9&layers=M">http://www.openstreetmap.org/?lat=51.529&lon=-100.42&zoom=9&layers=M</a>
<a class="moz-txt-link-freetext" href="http://www.openstreetmap.org/?lat=51.547&lon=-101.033&zoom=10&layers=M">http://www.openstreetmap.org/?lat=51.547&lon=-101.033&zoom=10&layers=M</a>
<a class="moz-txt-link-freetext" href="http://www.openstreetmap.org/?lat=51.564&lon=-101.206&zoom=11&layers=M">http://www.openstreetmap.org/?lat=51.564&lon=-101.206&zoom=11&layers=M</a>

Notice that some areas are fine at some zoom levels where the same areas
are not at other levels.  

I am not about to go and do the whole "/dirty" thing on all the tiles that
are not rendering correctly. :)



  </pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<font size="2"><b>G. Michael Carter</b><br>
</font><font color="#666666"
 face="Verdana, Arial, Helvetica, sans-serif" size="2">
Contact: H: 1-519-940-8935 | W: 1-905-267-8494 | M: 1-519-215-1869 | F:
1-519-941-0009 <br>
Google Talk: <a href="xmpp:mikeycarter1974@gmail.com">xmpp:mikeycarter1974@gmail.com</a><br>
<br>
</font>
<a
 href="http://www.openstreetmap.org/?lat=43.9216&lon=-80.105&zoom=14&layers=B000FTF"><img
 src="cid:part1.06050803.04020004@carterfamily.ca" border="0"></a><a
 href="http://livedvd.carterfamily.ca/"><img
 src="cid:part2.04040708.00050609@carterfamily.ca" border="0"></a>
</div>
</body>
</html>