Beispiel #1
0
 def GET(layer, zoom, x, y):
     ini = time.clock()
     path_configfile = os.path.join(request.folder, 'static/tilestache.cfg')
     config2 = ts.parseConfigfile(path_configfile)
     formato = request.extension
     token_version = "x234dffx"
     response.headers["Cache-Control"] = "public, max-age=100"
     if request.env.http_if_none_match == token_version:
         raise HTTP(304, "", **response.headers)
     else:
         try:
             layer2 = config2.layers[layer]
             coord = ts.Coordinate(int(y), int(x), int(zoom))
             mime_type, tile_content = ts.getTile(layer2, coord, formato)
         except:
             raise HTTP(404)
         response.headers["Content-Type"] = mime_type
         response.headers["Etag"] = token_version
         raise HTTP(200, tile_content, **response.headers)
     return locals()