| from flask import Flask, Response, send_file, jsonify, request, make_response | |
| import io | |
| import requests | |
| import os | |
| import json | |
| #app = Flask(__name__) | |
| #@app.route('/map/<int:z>/<string:x>/<string:y>.png') | |
| def get_tile(z, x, y): | |
| url = 'https://tile.openstreetmap.org/{}/{}-{}.png'.format(z, x, y) | |
| resp = requests.get(url) | |
| img_byte_arr = bytearray(resp.content) | |
| img_io = io.BytesIO(img_byte_arr) | |
| return img_io | |
| #return make_response(img_io.read(), mimetype='image/png') | |
| #if __name__ == "__main__": | |
| # app.run() | |