From 9b3eba0f59aba21ee3f70755f6381d1e175f8d45 Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Fri, 29 Jan 2016 23:38:29 +0300 Subject: [PATCH] =?utf8?q?=D0=A3=D0=BF=D1=80=D0=BE=D1=89=D0=B5=D0=BD=D0=BD?= =?utf8?q?=D1=8B=D0=B9=20=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BE=D0=BA=20?= =?utf8?q?=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0=20-=20=D1=81=20=D0=BF=D0=B5?= =?utf8?q?=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B5=D0=B9=20=D0=BA=D0=BE=D0=BE?= =?utf8?q?=D1=80=D0=B4=D0=B8=D0=BD=D0=B0=D1=82=20=D0=B2=D0=BC=D0=B5=D1=81?= =?utf8?q?=D1=82=D0=BE=20=D0=BD=D0=BE=D0=BC=D0=B5=D1=80=D0=B0=20=D1=82?= =?utf8?q?=D0=B0=D0=B9=D0=BB=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- render_tiles.py | 50 ++++++++++--------------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/render_tiles.py b/render_tiles.py index 5dae029..3d95a85 100644 --- a/render_tiles.py +++ b/render_tiles.py @@ -20,45 +20,15 @@ def queue_tiles(db,minlat,minlon,maxlat,maxlon,forced_max_zoom=None): # определяем примерный стартовый зум - 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() @@ -68,22 +38,22 @@ def process_queue(db,map,force=False): 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 -- 2.34.1