qsomap/web.py

26 lines
572 B
Python
Executable file

#!/usr/bin/env python3
from bottle import response, route, run, template, static_file
from io import StringIO
import qsomap
@route('/render/<lat>/<lon>.svg')
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()
@route('/')
@route('/index.html')
def index():
return template('index')
@route('/static/<filename:path>')
def send_static(filename):
return static_file(filename, root='./static')
run(host='localhost', port=8080)