6c8c3b138d
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.
19 lines
580 B
Python
19 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
|