Web interface with map where user can place pin for testing

Closes: #21
This commit is contained in:
Edward Betts 2024-01-10 16:25:22 +00:00
parent 1625f3d5d1
commit e1f6b09ec1
2 changed files with 32 additions and 0 deletions

View file

@ -410,5 +410,35 @@ def reports() -> str:
)
@app.route("/pin/<lat>/<lon>")
def pin_detail(lat: str, lon: str) -> Response:
"""Details for map pin location."""
reply = lat_lon_to_wikidata(float(lat), float(lon))
element = reply["result"].pop("element", None)
geojson = reply["result"].pop("geojson", None)
css = HtmlFormatter().get_style_defs(".highlight")
html = render_template(
"pin_detail.html",
lat=lat,
lon=lon,
str=str,
element_id=element,
geojson=geojson,
css=css,
**reply,
)
return jsonify(html=html)
@app.route("/map")
def map_page() -> str:
"""Map page."""
css = HtmlFormatter().get_style_defs(".highlight")
return render_template("map.html", css=css)
if __name__ == "__main__":
app.run(host="0.0.0.0")