# определяем примерный стартовый зум
- minlatrad = math.radians(minlat)
- maxlatrad = math.radians(maxlat)
-
- minx = (minlon + 180.0)/360.0
- maxx = (maxlon + 180.0)/360.0
-
- miny = (1.0 - math.log(math.tan(minlatrad) + (1 / math.cos(minlatrad))) / math.pi) / 2.0
- maxy = (1.0 - math.log(math.tan(maxlatrad) + (1 / math.cos(maxlatrad))) / math.pi) / 2.0
-
- if minx>maxx:
- minx,maxx = maxx,minx
-
- if miny>maxy:
- miny,maxy = maxy,miny
-
minzoom=8
if forced_max_zoom:
maxzoom=forced_max_zoom
else:
maxzoom=16
- for zoom in range(minzoom,maxzoom+1):
-
- n = 2 ** zoom
-
- minxt = int(minx * n)
- minyt = int(miny * n)
- maxxt = int(maxx * n)
- maxyt = int(maxy * n)
-
- ins = conn.cursor()
- print zoom,minxt,maxxt,minyt,maxyt
- ins.execute('insert into render_queue(zoom,minx,maxx,miny,maxy) values(?,?,?,?,?)',(zoom,minxt,maxxt,minyt,maxyt))
-
- if forced_max_zoom is None:
- if (maxxt-minxt>32) or (maxyt-minyt>24):
- print "Breaking..."
- conn.commit()
- break
+ ins = conn.cursor()
+ print minlat,maxlat,minlon,maxlon,minzoom,maxzoom
+ ins.execute('insert into render_queue(minlat,maxlat,minlon,maxlon,minzoom,maxzoom) values(?,?,?,?,?,?)',(minlat,maxlat,minlon,maxlon,minzoom,maxzoom))
conn.commit()
conn = sqlite3.connect(db)
cur = conn.cursor()
- cur.execute('select id,zoom,minx,maxx,miny,maxy from render_queue')
+ cur.execute('select id,minlat,maxlat,minlon,maxlon,minzoom,maxzoom from render_queue')
list=cur.fetchall()
for rec in list:
- id,zoom,minx,maxx,miny,maxy=rec
+ id,minlat,maxlat,minlon,maxlon,minzoom,maxzoom=rec
command = 'map='+map+ \
- ' z='+str(zoom)+ \
- ' x='+str(minx)+'-'+str(maxx)+ \
- ' y='+str(miny)+'-'+str(maxy)
+ ' z='+str(minzoom)+'-'+str(maxzoom)+ \
+ ' lat='+str(minlat)+','+str(maxlat)+ \
+ ' lon='+str(minlon)+','+str(maxlon)
if force:
- command = 'tirex-batch '+command
+ command = 'tirex-batch -n 0 '+command
else:
- command = 'tirex-batch '+command+' -f not-exists'
+ command = 'tirex-batch -n 0 '+command+' -f not-exists'
print command