diff --git a/app.py b/app.py index cab4b75..d6b360a 100755 --- a/app.py +++ b/app.py @@ -31,6 +31,16 @@ def showMap(threewords): err="Could not find location {}".format(threewords)) +@get('/latlng/,') +def showMapFromLatLng(lat, lng): + try: + threewords = these.three_words((lat, lng)) + return template('map', lat=lat, lng=lng, threewords=threewords) + except: + return template('index', + err="Could not find location {}".format(threewords)) + + # API @get('/api/,') def latLngToHash(lat, lng): diff --git a/static/js/app.js b/static/js/app.js index ce17a06..a0f64fc 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -134,6 +134,8 @@ var These3Words = (function () { return { - Map: Map + Map: Map, + apiGet: apiGet, + apiGetFromLatLng: apiGetFromLatLng }; }()); diff --git a/views/index.html b/views/index.html index 931c71a..4b96b8a 100644 --- a/views/index.html +++ b/views/index.html @@ -8,6 +8,8 @@ + +
@@ -30,23 +32,38 @@ -
+