2023-11-13 20:04:45 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2023-11-14 22:07:47 +01:00
|
|
|
from bottle import Bottle, request, response, template, static_file
|
2023-11-13 20:04:45 +01:00
|
|
|
from io import StringIO
|
|
|
|
import qsomap
|
|
|
|
|
2023-11-14 22:07:47 +01:00
|
|
|
app = application = Bottle()
|
|
|
|
|
|
|
|
@app.route('/render/map.svg')
|
|
|
|
def render():
|
2023-11-13 20:04:45 +01:00
|
|
|
svg_stream = StringIO()
|
2023-11-14 22:07:47 +01:00
|
|
|
qsomap.render(float(request.query.lat), float(request.query.lon), svg_stream, None)
|
2023-11-13 20:04:45 +01:00
|
|
|
response.content_type = 'image/svg+xml'
|
|
|
|
return svg_stream.getvalue()
|
|
|
|
|
2023-11-13 22:58:46 +01:00
|
|
|
|
2023-11-14 22:07:47 +01:00
|
|
|
@app.route('/')
|
|
|
|
@app.route('/index.html')
|
2023-11-13 22:58:46 +01:00
|
|
|
def index():
|
|
|
|
return template('index')
|
|
|
|
|
|
|
|
|
2023-11-14 22:07:47 +01:00
|
|
|
@app.route('/static/<filename:path>')
|
2023-11-13 22:58:46 +01:00
|
|
|
def send_static(filename):
|
|
|
|
return static_file(filename, root='./static')
|
|
|
|
|
2023-11-14 22:07:47 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
app.run(host='localhost', port=8080)
|