diff options
| author | Code WvS <code-wvs@quantentunnel.de> | 2015-02-28 17:51:52 +0100 |
|---|---|---|
| committer | Code WvS <code-wvs@quantentunnel.de> | 2015-02-28 17:51:52 +0100 |
| commit | 6c76ce64d7fb274eb70f4feef17a9bf6dd2093ca (patch) | |
| tree | f23ed25c6fe53c6ec4f92c6599df9c4eacedb7ba /threads.js | |
| parent | 881165be429151d8f2593c6893dd23da90a5288b (diff) | |
| download | snap-yow-6c76ce64d7fb274eb70f4feef17a9bf6dd2093ca.tar.gz snap-yow-6c76ce64d7fb274eb70f4feef17a9bf6dd2093ca.zip | |
add geocoding block
Diffstat (limited to 'threads.js')
| -rw-r--r-- | threads.js | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -2642,6 +2642,32 @@ Process.prototype.addMarker = function (pos) { L.marker(pos.contents).addTo(window.map); }; +Process.prototype.reportGeocode = function (lon, lat) { + var myself = this; + + if (!myself.context.jsonpScript) { + window.OSM_JSONP_Callback = function (data) { + myself.context.json = data; + window.OSM_JSONP_Callback = undefined; + }; + myself.context.jsonpScript = document.createElement('script'); + myself.context.jsonpScript.src = + 'https://nominatim.openstreetmap.org/reverse' + + '?format=json&json_callback=OSM_JSONP_Callback' + + '&addressdetails=0&limit=1&zoom=18' + + '&lon=' + lon + '&lat=' + lat; + document.getElementsByTagName('HEAD')[0] + .appendChild(myself.context.jsonpScript); + } else { + if (myself.context.json) { + return myself.context.json.display_name; + } + } + + this.pushContext('doYield'); + this.pushContext(); +} + Process.prototype.findLocation = function (searchString) { var myself = this; @@ -2655,7 +2681,7 @@ Process.prototype.findLocation = function (searchString) { 'https://nominatim.openstreetmap.org/search' + '?format=json&json_callback=OSM_JSONP_Callback' + '&addressdetails=0&limit=1' - + '&q=' + myself.inputOption(searchString); + + '&q=' + searchString; document.getElementsByTagName('HEAD')[0] .appendChild(myself.context.jsonpScript); } else { |
