1 Star 0 Fork 0

郑玉燕同学/offline-tileServer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.py 727 Bytes
一键复制 编辑 原始数据 按行查看 历史
import requests
from flask import Flask, Response, jsonify, render_template, request
from collections import namedtuple, Counter
import json
Tile = namedtuple('Tile', ['x', 'y', 'z'])
tile_counter = Counter()
app = Flask(__name__)
@app.route("/tile")
def tile():
x = request.args['x']
y = request.args['y']
z = request.args['z']
t = Tile(x, y, z)
with open('./tilefile/%s/%s_%s.png'%(z, x, y), 'rb') as f:
image = f.read()
tile_counter[t] += 1
return Response(image, mimetype='image/jpeg')
@app.route('/', methods=['GET'])
def map():
return render_template('index.html')
if __name__ == "__main__":
app.run(host='0.0.0.0', debug = True, threaded=True)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhengyuyan/offline-tileServer.git
git@gitee.com:zhengyuyan/offline-tileServer.git
zhengyuyan
offline-tileServer
offline-tileServer
master

搜索帮助