[Talk-ca] Any way to "dirty" large areas of Mapnik?
G. Michael Carter
mikey at carterfamily.ca
Tue Aug 10 14:13:09 BST 2010
Play with this:
#!/usr/bin/python
from math import pi,cos,sin,log,exp,atan,ceil,floor,radians,tan
from subprocess import call
import sys, os
from Queue import Queue
import mapnik
import threading
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - log(tan(lat_rad) + (1 / cos(lat_rad))) / pi) /
2.0 * n)
return(xtile, ytile)
def minmax (a,b,c):
a = max(a,b)
a = min(a,c)
return a
def dirty_tiles(bbox):
for z in range(5,18):
str_z = "%s" % z
px0 = deg2num(bbox[1], bbox[0], z)
px1 = deg2num(bbox[3], bbox[2], z)
#print px0, px1
for x in range(int(px0[0]),int(px1[0])+1):
str_x = "%s" % x
for y in range(int(px0[1]),int(px1[1])+1):
str_y = "%s" % y
dirty_uri = 'curl http://b.tile.openstreetmap.org/' +
str_z + '/' + str_x + '/' + str_y + '.png/dirty; sleep 2;'
print dirty_uri
if __name__ == "__main__":
home = "."
#-------------------------------------------------------------------------
#
# Change the following for different bounding boxes and zoom levels
#
# Start with an overview
# if sys.argv[0] is None:
# print "usage dirty.py: tilename max_lat max_lon min_lat min_lon"
# exit
bbox =
(float(sys.argv[2]),float(sys.argv[3]),float(sys.argv[4]),float(sys.argv[5]))
# bbox = (-87.0,49.0,-82.0,45.0)
# bbox = (-81.0,52.0,-70.0,38.0)
print "#",sys.argv[1],":",bbox
dirty_tiles(bbox)
On 08/08/10 08:26 PM, Tyler Gunn wrote:
> 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:
> http://www.openstreetmap.org/?lat=51.529&lon=-100.42&zoom=9&layers=M
> http://www.openstreetmap.org/?lat=51.547&lon=-101.033&zoom=10&layers=M
> http://www.openstreetmap.org/?lat=51.564&lon=-101.206&zoom=11&layers=M
>
> 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. :)
>
>
>
>
--
*G. Michael Carter*
Contact: H: 1-519-940-8935 | W: 1-905-267-8494 | M: 1-519-215-1869 | F:
1-519-941-0009
Google Talk: xmpp:mikeycarter1974 at gmail.com
<http://www.openstreetmap.org/?lat=43.9216&lon=-80.105&zoom=14&layers=B000FTF>
<http://livedvd.carterfamily.ca/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk-ca/attachments/20100810/64f8d5c5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osm_logo.resized.png
Type: image/png
Size: 6761 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk-ca/attachments/20100810/64f8d5c5/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fedora.png
Type: image/png
Size: 5316 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk-ca/attachments/20100810/64f8d5c5/attachment-0001.png>
More information about the Talk-ca
mailing list