Axione-IPE-Viewer/webapp/main.py
Félix Baylac-Jacqué 6c8c3b138d webapp: fetch eligibility data on backend
We fetch the eligibility data from the backend for the area the user
is currently viewing.

We don't want to trigger the search when the user is zoomed out, it
could be heavy on the backend CPU. Hence, we trigger the fetch after
the user searched for his real address or reached a good-enough zoom level.

The backend is currently returning a dummy answer.
2022-02-21 17:21:21 +01:00

20 lines
580 B
Python

from flask import Flask, request, render_template
app = Flask(__name__)
@app.route("/", methods=['GET'])
def getMap():
return render_template("map.html")
@app.route("/eligdata", methods=['GET'])
def getEligData():
args = request.args
if 'swx' in args and 'swy' in args and \
'nex' in args and 'ney' in args:
return { "buildings": [
{"x": args['swx'], "y":args['swy'], "label": "dummy elig val" },
{"x": args['nex'], "y":args['ney'], "label": "dummy elig val 2" }
]}
else:
return "Missing coordinates", 400