From 84a2cfa5ad7f1521442c433177f7f66d72a02d11 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 13 Nov 2021 16:43:30 +0000 Subject: [PATCH] Add API method to return osm2pgsql polygon as geojson. --- web_view.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web_view.py b/web_view.py index 70678ca..6fee4d2 100755 --- a/web_view.py +++ b/web_view.py @@ -546,6 +546,15 @@ def api_search(): return cors_jsonify(success=True, hits=hits) +@app.route("/api/1/polygon//") +def api_polygon(osm_type, osm_id): + obj = model.Polygon.get_osm(osm_type, osm_id) + return cors_jsonify(successful=True, + osm_type=osm_type, + osm_id=osm_id, + geojson=obj.geojson()) + + @app.route("/refresh/Q") def refresh_item(item_id): assert not model.Item.query.get(item_id)