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