8 def queue_render(db,filename):
10 conn = sqlite3.connect(db)
13 cur.execute("select minlat,minlon,maxlat,maxlon from tracks where filename=?" , (filename.decode('UTF-8'),))
15 minlat,minlon,maxlat,maxlon=cur.fetchone()
17 # определяем примерный стартовый зум
19 minlatrad = math.radians(minlat)
20 maxlatrad = math.radians(maxlat)
22 minx = (minlon + 180.0)/360.0
23 maxx = (maxlon + 180.0)/360.0
25 miny = (1.0 - math.log(math.tan(minlatrad) + (1 / math.cos(minlatrad))) / math.pi) / 2.0
26 maxy = (1.0 - math.log(math.tan(maxlatrad) + (1 / math.cos(maxlatrad))) / math.pi) / 2.0
34 for zoom in range(9,16):
44 print zoom,minxt,maxxt,minyt,maxyt
45 ins.execute('insert into render_queue(zoom,minx,maxx,miny,maxy) values(?,?,?,?,?)',(zoom,minxt,maxxt,minyt,maxyt))
47 if (maxxt-minxt>16) or (maxyt-minyt>12):