added flag to generate gzipped MVT PBF
This commit is contained in:
parent
66d17625d8
commit
b60a8f42f2
@ -17,6 +17,8 @@ import yaml
|
|||||||
import sys
|
import sys
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
|
import gzip
|
||||||
|
|
||||||
def GetTM2Source(file):
|
def GetTM2Source(file):
|
||||||
with open(file,'r') as stream:
|
with open(file,'r') as stream:
|
||||||
tm2source = yaml.load(stream)
|
tm2source = yaml.load(stream)
|
||||||
@ -43,6 +45,8 @@ DBSession = sessionmaker(bind=engine)
|
|||||||
session = DBSession()
|
session = DBSession()
|
||||||
session.execute(prepared)
|
session.execute(prepared)
|
||||||
|
|
||||||
|
gziped = os.getenv('GZIP') == 'true'
|
||||||
|
|
||||||
def bounds(zoom,x,y):
|
def bounds(zoom,x,y):
|
||||||
inProj = pyproj.Proj(init='epsg:4326')
|
inProj = pyproj.Proj(init='epsg:4326')
|
||||||
outProj = pyproj.Proj(init='epsg:3857')
|
outProj = pyproj.Proj(init='epsg:3857')
|
||||||
@ -81,6 +85,8 @@ def get_mvt(zoom,x,y):
|
|||||||
final_tile = b''
|
final_tile = b''
|
||||||
for layer in layers:
|
for layer in layers:
|
||||||
final_tile = final_tile + io.BytesIO(layer).getvalue()
|
final_tile = final_tile + io.BytesIO(layer).getvalue()
|
||||||
|
if gziped:
|
||||||
|
final_tile = gzip.compress(final_tile)
|
||||||
return final_tile
|
return final_tile
|
||||||
|
|
||||||
class GetTile(tornado.web.RequestHandler):
|
class GetTile(tornado.web.RequestHandler):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user