diff --git a/README.md b/README.md index af5d6bc..eb84174 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ This package contains following packages: - [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore) - [Leaflet.loading 0.1.24](https://github.com/ebrelsford/Leaflet.loading) - [Leaflet.Control.FullScreen 1.4.5](https://github.com/brunob/leaflet.fullscreen) - - [Leaflet Control Geocoder 1.5.8](https://github.com/perliedman/leaflet-control-geocoder) + - [Leaflet Control Geocoder 1.6.0](https://github.com/perliedman/leaflet-control-geocoder) - [Leaflet.ExtraMarkers 1.0.6](https://github.com/coryasilva/Leaflet.ExtraMarkers) - [leaflet.pm 0.23.1](https://github.com/codeofsumit/leaflet.pm) - [osmtogeojson 2.2.12](https://github.com/tyrasd/osmtogeojson) diff --git a/assets/control-geocoder/Control.Geocoder.css b/assets/control-geocoder/Control.Geocoder.css index f89d72e..00c3225 100644 --- a/assets/control-geocoder/Control.Geocoder.css +++ b/assets/control-geocoder/Control.Geocoder.css @@ -1,123 +1,126 @@ .leaflet-control-geocoder { - border-radius: 4px; - background: white; - min-width: 26px; - min-height: 26px; + border-radius: 4px; + background: white; + min-width: 26px; + min-height: 26px; } .leaflet-touch .leaflet-control-geocoder { - min-width: 30px; - min-height: 30px; + min-width: 30px; + min-height: 30px; } -.leaflet-control-geocoder a, .leaflet-control-geocoder .leaflet-control-geocoder-icon { - border-bottom: none; - display: inline-block; +.leaflet-control-geocoder a, +.leaflet-control-geocoder .leaflet-control-geocoder-icon { + border-bottom: none; + display: inline-block; } .leaflet-control-geocoder .leaflet-control-geocoder-alternatives a { - width: inherit; - height: inherit; - line-height: inherit; + width: inherit; + height: inherit; + line-height: inherit; } -.leaflet-control-geocoder a:hover, .leaflet-control-geocoder .leaflet-control-geocoder-icon:hover { - border-bottom: none; - display: inline-block; +.leaflet-control-geocoder a:hover, +.leaflet-control-geocoder .leaflet-control-geocoder-icon:hover { + border-bottom: none; + display: inline-block; } .leaflet-control-geocoder-form { - display: none; - vertical-align: middle; + display: none; + vertical-align: middle; } .leaflet-control-geocoder-expanded .leaflet-control-geocoder-form { - display: inline-block; + display: inline-block; } .leaflet-control-geocoder-form input { - font-size: 120%; - border: 0; - background-color: transparent; - width: 246px; + font-size: 120%; + border: 0; + background-color: transparent; + width: 246px; } .leaflet-control-geocoder-icon { - border-radius: 4px; - width: 26px; - height: 26px; - border: none; - background-color: white; - background-image: url(images/geocoder.png); - background-repeat: no-repeat; - background-position: center; - cursor: pointer; + border-radius: 4px; + width: 26px; + height: 26px; + border: none; + background-color: white; + background-image: url(images/geocoder.png); + background-repeat: no-repeat; + background-position: center; + cursor: pointer; } .leaflet-touch .leaflet-control-geocoder-icon { - width: 30px; - height: 30px; + width: 30px; + height: 30px; } .leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon { - background-image: url(images/throbber.gif); + background-image: url(images/throbber.gif); } .leaflet-control-geocoder-form-no-error { - display: none; + display: none; } .leaflet-control-geocoder-form input:focus { - outline: none; + outline: none; } .leaflet-control-geocoder-form button { - display: none; + display: none; } .leaflet-control-geocoder-error { - margin-top: 8px; - margin-left: 8px; - display: block; - color: #444; + margin-top: 8px; + margin-left: 8px; + display: block; + color: #444; } .leaflet-control-geocoder-alternatives { - display: block; - width: 272px; - list-style: none; - padding: 0; - margin: 0; + display: block; + width: 272px; + list-style: none; + padding: 0; + margin: 0; } .leaflet-control-geocoder-alternatives-minimized { - display: none; - height: 0; + display: none; + height: 0; } .leaflet-control-geocoder-alternatives li { - white-space: nowrap; - display: block; - overflow: hidden; - padding: 5px 8px; - text-overflow: ellipsis; - border-bottom: 1px solid #ccc; - cursor: pointer; + white-space: nowrap; + display: block; + overflow: hidden; + padding: 5px 8px; + text-overflow: ellipsis; + border-bottom: 1px solid #ccc; + cursor: pointer; } -.leaflet-control-geocoder-alternatives li a, .leaflet-control-geocoder-alternatives li a:hover { - width: inherit; - height: inherit; - line-height: inherit; - background: inherit; - border-radius: inherit; - text-align: left; +.leaflet-control-geocoder-alternatives li a, +.leaflet-control-geocoder-alternatives li a:hover { + width: inherit; + height: inherit; + line-height: inherit; + background: inherit; + border-radius: inherit; + text-align: left; } .leaflet-control-geocoder-alternatives li:last-child { - border-bottom: none; + border-bottom: none; } -.leaflet-control-geocoder-alternatives li:hover, .leaflet-control-geocoder-selected { - background-color: #f5f5f5; +.leaflet-control-geocoder-alternatives li:hover, +.leaflet-control-geocoder-selected { + background-color: #f5f5f5; } .leaflet-control-geocoder-address-detail { - } .leaflet-control-geocoder-address-context { - color: #666; -} \ No newline at end of file + color: #666; +} diff --git a/assets/control-geocoder/Control.Geocoder.js b/assets/control-geocoder/Control.Geocoder.js index 8d48be2..78408d4 100644 --- a/assets/control-geocoder/Control.Geocoder.js +++ b/assets/control-geocoder/Control.Geocoder.js @@ -1,1296 +1,1348 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.leafletControlGeocoder = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0) { - this._alts.innerHTML = ''; - this._results = results; - L.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); - for (var i = 0; i < results.length; i++) { - this._alts.appendChild(this._createAlt(results[i], i)); - } - } else { - L.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error'); - } - }, - - markGeocode: function(result) { - result = result.geocode || result; - - this._map.fitBounds(result.bbox); - - if (this._geocodeMarker) { - this._map.removeLayer(this._geocodeMarker); - } - - this._geocodeMarker = new L.Marker(result.center) - .bindPopup(result.html || result.name) - .addTo(this._map) - .openPopup(); - - return this; - }, - - _geocode: function(suggest) { - var requestCount = ++this._requestCount, - mode = suggest ? 'suggest' : 'geocode', - eventData = {input: this._input.value}; - - this._lastGeocode = this._input.value; - if (!suggest) { - this._clearResults(); - } - - this.fire('start' + mode, eventData); - this.options.geocoder[mode](this._input.value, function(results) { - if (requestCount === this._requestCount) { - eventData.results = results; - this.fire('finish' + mode, eventData); - this._geocodeResult(results, suggest); - } - }, this); - }, - - _geocodeResultSelected: function(result) { - this.fire('markgeocode', {geocode: result}); - }, - - _toggle: function() { - if (L.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) { - this._collapse(); - } else { - this._expand(); - } - }, - - _expand: function () { - L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded'); - this._input.select(); - this.fire('expand'); - }, - - _collapse: function () { - L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded'); - L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); - L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); - this._input.blur(); // mobile: keyboard shouldn't stay expanded - this.fire('collapse'); - }, - - _clearResults: function () { - L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); - this._selection = null; - L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); - }, - - _createAlt: function(result, index) { - var li = L.DomUtil.create('li', ''), - a = L.DomUtil.create('a', '', li), - icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null, - text = result.html ? undefined : document.createTextNode(result.name), - mouseDownHandler = function mouseDownHandler(e) { - // In some browsers, a click will fire on the map if the control is - // collapsed directly after mousedown. To work around this, we - // wait until the click is completed, and _then_ collapse the - // control. Messy, but this is the workaround I could come up with - // for #142. - this._preventBlurCollapse = true; - L.DomEvent.stop(e); - this._geocodeResultSelected(result); - L.DomEvent.on(li, 'click', function() { - if (this.options.collapsed) { - this._collapse(); - } else { - this._clearResults(); - } - }, this); - }; - - if (icon) { - icon.src = result.icon; - } - - li.setAttribute('data-result-index', index); - - if (result.html) { - a.innerHTML = a.innerHTML + result.html; - } else { - a.appendChild(text); - } - - // Use mousedown and not click, since click will fire _after_ blur, - // causing the control to have collapsed and removed the items - // before the click can fire. - L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this); - - return li; - }, - - _keydown: function(e) { - var _this = this, - select = function select(dir) { - if (_this._selection) { - L.DomUtil.removeClass(_this._selection, 'leaflet-control-geocoder-selected'); - _this._selection = _this._selection[dir > 0 ? 'nextSibling' : 'previousSibling']; - } - if (!_this._selection) { - _this._selection = _this._alts[dir > 0 ? 'firstChild' : 'lastChild']; - } - - if (_this._selection) { - L.DomUtil.addClass(_this._selection, 'leaflet-control-geocoder-selected'); - } - }; - - switch (e.keyCode) { - // Escape - case 27: - if (this.options.collapsed) { - this._collapse(); - } - break; - // Up - case 38: - select(-1); - break; - // Up - case 40: - select(1); - break; - // Enter - case 13: - if (this._selection) { - var index = parseInt(this._selection.getAttribute('data-result-index'), 10); - this._geocodeResultSelected(this._results[index]); - this._clearResults(); - } else { - this._geocode(); - } - break; - } - }, - _change: function(e) { - var v = this._input.value; - if (v !== this._lastGeocode) { - clearTimeout(this._suggestTimeout); - if (v.length >= this.options.suggestMinLength) { - this._suggestTimeout = setTimeout(L.bind(function() { - this._geocode(true); - }, this), this.options.suggestTimeout); - } else { - this._clearResults(); - } - } - } - }), - factory: function(options) { - return new L.Control.Geocoder(options); - } +// Adapted from handlebars.js +// https://github.com/wycats/handlebars.js/ +var badChars = /[&<>"'`]/g; +var possible = /[&<>"'`]/; +var escape = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./geocoders/nominatim":9}],2:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); +function escapeChar(chr) { + return escape[chr]; +} -module.exports = { - "class": L.Class.extend({ - options: { - service_url: 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer' - }, +function htmlEscape(string) { + if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } - initialize: function(accessToken, options) { - L.setOptions(this, options); - this._accessToken = accessToken; - }, + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = '' + string; - geocode: function(query, cb, context) { - var params = { - SingleLine: query, - outFields: 'Addr_Type', - forStorage: false, - maxLocations: 10, - f: 'json' - }; + if (!possible.test(string)) { + return string; + } + return string.replace(badChars, escapeChar); +} - if (this._key && this._key.length) { - params.token = this._key; - } +function jsonp(url, params, callback, context, jsonpParam) { + var callbackId = '_l_geocoder_' + lastCallbackId++; + params[jsonpParam || 'callback'] = callbackId; + window[callbackId] = L.Util.bind(callback, context); + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = url + L.Util.getParamString(params); + script.id = callbackId; + document.getElementsByTagName('head')[0].appendChild(script); +} - Util.getJSON(this.options.service_url + '/findAddressCandidates', params, function(data) { - var results = [], - loc, - latLng, - latLngBounds; - - if (data.candidates && data.candidates.length) { - for (var i = 0; i <= data.candidates.length - 1; i++) { - loc = data.candidates[i]; - latLng = L.latLng(loc.location.y, loc.location.x); - latLngBounds = L.latLngBounds(L.latLng(loc.extent.ymax, loc.extent.xmax), L.latLng(loc.extent.ymin, loc.extent.xmin)); - results[i] = { - name: loc.address, - bbox: latLngBounds, - center: latLng - }; - } - } - - cb.call(context, results); - }); - }, - - suggest: function(query, cb, context) { - return this.geocode(query, cb, context); - }, - - reverse: function(location, scale, cb, context) { - var params = { - location: encodeURIComponent(location.lng) + ',' + encodeURIComponent(location.lat), - distance: 100, - f: 'json' - }; - - Util.getJSON(this.options.service_url + '/reverseGeocode', params, function(data) { - var result = [], - loc; - - if (data && !data.error) { - loc = L.latLng(data.location.y, data.location.x); - result.push({ - name: data.address.Match_addr, - center: loc, - bounds: L.latLngBounds(loc, loc) - }); - } - - cb.call(context, result); - }); - } - }), - - factory: function(accessToken, options) { - return new L.Control.Geocoder.ArcGis(accessToken, options); - } -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],3:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); - -module.exports = { - "class": L.Class.extend({ - initialize: function(key) { - this.key = key; - }, - - geocode : function (query, cb, context) { - Util.jsonp('https://dev.virtualearth.net/REST/v1/Locations', { - query: query, - key : this.key - }, function(data) { - var results = []; - if( data.resourceSets.length > 0 ){ - for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) { - var resource = data.resourceSets[0].resources[i], - bbox = resource.bbox; - results[i] = { - name: resource.name, - bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), - center: L.latLng(resource.point.coordinates) - }; - } - } - cb.call(context, results); - }, this, 'jsonp'); - }, - - reverse: function(location, scale, cb, context) { - Util.jsonp('//dev.virtualearth.net/REST/v1/Locations/' + location.lat + ',' + location.lng, { - key : this.key - }, function(data) { - var results = []; - for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) { - var resource = data.resourceSets[0].resources[i], - bbox = resource.bbox; - results[i] = { - name: resource.name, - bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), - center: L.latLng(resource.point.coordinates) - }; - } - cb.call(context, results); - }, this, 'jsonp'); - } - }), - - factory: function(key) { - return new L.Control.Geocoder.Bing(key); - } -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],4:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); - -module.exports = { - "class": L.Class.extend({ - options: { - serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json', - geocodingQueryParams: {}, - reverseQueryParams: {} - }, - - initialize: function(key, options) { - this._key = key; - L.setOptions(this, options); - // Backwards compatibility - this.options.serviceUrl = this.options.service_url || this.options.serviceUrl; - }, - - geocode: function(query, cb, context) { - var params = { - address: query - }; - - if (this._key && this._key.length) { - params.key = this._key; - } - - params = L.Util.extend(params, this.options.geocodingQueryParams); - - Util.getJSON(this.options.serviceUrl, params, function(data) { - var results = [], - loc, - latLng, - latLngBounds; - if (data.results && data.results.length) { - for (var i = 0; i <= data.results.length - 1; i++) { - loc = data.results[i]; - latLng = L.latLng(loc.geometry.location); - latLngBounds = L.latLngBounds(L.latLng(loc.geometry.viewport.northeast), L.latLng(loc.geometry.viewport.southwest)); - results[i] = { - name: loc.formatted_address, - bbox: latLngBounds, - center: latLng, - properties: loc.address_components - }; - } - } - - cb.call(context, results); - }); - }, - - reverse: function(location, scale, cb, context) { - var params = { - latlng: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng) - }; - params = L.Util.extend(params, this.options.reverseQueryParams); - if (this._key && this._key.length) { - params.key = this._key; - } - - Util.getJSON(this.options.serviceUrl, params, function(data) { - var results = [], - loc, - latLng, - latLngBounds; - if (data.results && data.results.length) { - for (var i = 0; i <= data.results.length - 1; i++) { - loc = data.results[i]; - latLng = L.latLng(loc.geometry.location); - latLngBounds = L.latLngBounds(L.latLng(loc.geometry.viewport.northeast), L.latLng(loc.geometry.viewport.southwest)); - results[i] = { - name: loc.formatted_address, - bbox: latLngBounds, - center: latLng, - properties: loc.address_components - }; - } - } - - cb.call(context, results); - }); - } - }), - - factory: function(key, options) { - return new L.Control.Geocoder.Google(key, options); - } -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],5:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); - -module.exports = { - "class": L.Class.extend({ - options: { - geocodeUrl: 'http://geocoder.api.here.com/6.2/geocode.json', - reverseGeocodeUrl: 'http://reverse.geocoder.api.here.com/6.2/reversegeocode.json', - app_id: '', - app_code: '', - geocodingQueryParams: {}, - reverseQueryParams: {} - }, - - initialize: function(options) { - L.setOptions(this, options); - }, - - geocode: function(query, cb, context) { - var params = { - searchtext: query, - gen: 9, - app_id: this.options.app_id, - app_code: this.options.app_code, - jsonattributes: 1 - }; - params = L.Util.extend(params, this.options.geocodingQueryParams); - this.getJSON(this.options.geocodeUrl, params, cb, context); - }, - - reverse: function(location, scale, cb, context) { - var params = { - prox: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng), - mode: 'retrieveAddresses', - app_id: this.options.app_id, - app_code: this.options.app_code, - gen: 9, - jsonattributes: 1 - }; - params = L.Util.extend(params, this.options.reverseQueryParams); - this.getJSON(this.options.reverseGeocodeUrl, params, cb, context); - }, - - getJSON: function(url, params, cb, context) { - Util.getJSON(url, params, function(data) { - var results = [], - loc, - latLng, - latLngBounds; - if (data.response.view && data.response.view.length) { - for (var i = 0; i <= data.response.view[0].result.length - 1; i++) { - loc = data.response.view[0].result[i].location; - latLng = L.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude); - latLngBounds = L.latLngBounds(L.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude), L.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)); - results[i] = { - name: loc.address.label, - bbox: latLngBounds, - center: latLng - }; - } - } - cb.call(context, results); - }) - } - }), - - factory: function(options) { - return new L.Control.Geocoder.HERE(options); +function getJSON(url, params, callback) { + var xmlHttp = new XMLHttpRequest(); + xmlHttp.onreadystatechange = function() { + if (xmlHttp.readyState !== 4) { + return; } + if (xmlHttp.status !== 200 && xmlHttp.status !== 304) { + callback(''); + return; + } + callback(JSON.parse(xmlHttp.response)); + }; + xmlHttp.open('GET', url + L.Util.getParamString(params), true); + xmlHttp.setRequestHeader('Accept', 'application/json'); + xmlHttp.send(null); +} + +function template(str, data) { + return str.replace(/\{ *([\w_]+) *\}/g, function(str, key) { + var value = data[key]; + if (value === undefined) { + value = ''; + } else if (typeof value === 'function') { + value = value(data); + } + return htmlEscape(value); + }); +} + +var Nominatim = { + class: L.Class.extend({ + options: { + serviceUrl: 'https://nominatim.openstreetmap.org/', + geocodingQueryParams: {}, + reverseQueryParams: {}, + htmlTemplate: function(r) { + var a = r.address, + parts = []; + if (a.road || a.building) { + parts.push('{building} {road} {house_number}'); + } + + if (a.city || a.town || a.village || a.hamlet) { + parts.push( + '{postcode} {city} {town} {village} {hamlet}' + ); + } + + if (a.state || a.country) { + parts.push( + '{state} {country}' + ); + } + + return template(parts.join('
'), a, true); + } + }, + + initialize: function(options) { + L.Util.setOptions(this, options); + }, + + geocode: function(query, cb, context) { + getJSON( + this.options.serviceUrl + 'search', + L.extend( + { + q: query, + limit: 5, + format: 'json', + addressdetails: 1 + }, + this.options.geocodingQueryParams + ), + L.bind(function(data) { + var results = []; + for (var i = data.length - 1; i >= 0; i--) { + var bbox = data[i].boundingbox; + for (var j = 0; j < 4; j++) bbox[j] = parseFloat(bbox[j]); + results[i] = { + icon: data[i].icon, + name: data[i].display_name, + html: this.options.htmlTemplate ? this.options.htmlTemplate(data[i]) : undefined, + bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]), + center: L.latLng(data[i].lat, data[i].lon), + properties: data[i] + }; + } + cb.call(context, results); + }, this) + ); + }, + + reverse: function(location, scale, cb, context) { + getJSON( + this.options.serviceUrl + 'reverse', + L.extend( + { + lat: location.lat, + lon: location.lng, + zoom: Math.round(Math.log(scale / 256) / Math.log(2)), + addressdetails: 1, + format: 'json' + }, + this.options.reverseQueryParams + ), + L.bind(function(data) { + var result = [], + loc; + + if (data && data.lat && data.lon) { + loc = L.latLng(data.lat, data.lon); + result.push({ + name: data.display_name, + html: this.options.htmlTemplate ? this.options.htmlTemplate(data) : undefined, + center: loc, + bounds: L.latLngBounds(loc, loc), + properties: data + }); + } + + cb.call(context, result); + }, this) + ); + } + }), + + factory: function(options) { + return new L.Control.Geocoder.Nominatim(options); + } }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],6:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); +var Control = { + class: L.Control.extend({ + options: { + showResultIcons: false, + collapsed: true, + expand: 'touch', // options: touch, click, anythingelse + position: 'topright', + placeholder: 'Search...', + errorMessage: 'Nothing found.', + suggestMinLength: 3, + suggestTimeout: 250, + defaultMarkGeocode: true + }, -module.exports = { - "class": L.Class.extend({ - options: { - serviceUrl: 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places-v1/', - geocodingQueryParams: {}, - reverseQueryParams: {} - }, + includes: L.Evented.prototype || L.Mixin.Events, - initialize: function(accessToken, options) { - L.setOptions(this, options); - this.options.geocodingQueryParams.access_token = accessToken; - this.options.reverseQueryParams.access_token = accessToken; - }, + initialize: function(options) { + L.Util.setOptions(this, options); + if (!this.options.geocoder) { + this.options.geocoder = new Nominatim.class(); + } - geocode: function(query, cb, context) { - var params = this.options.geocodingQueryParams; - if (typeof params.proximity !== 'undefined' - && params.proximity.hasOwnProperty('lat') - && params.proximity.hasOwnProperty('lng')) - { - params.proximity = params.proximity.lng + ',' + params.proximity.lat; - } - Util.getJSON(this.options.serviceUrl + encodeURIComponent(query) + '.json', params, function(data) { - var results = [], - loc, - latLng, - latLngBounds; - if (data.features && data.features.length) { - for (var i = 0; i <= data.features.length - 1; i++) { - loc = data.features[i]; - latLng = L.latLng(loc.center.reverse()); - if (loc.hasOwnProperty('bbox')) - { - latLngBounds = L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()), L.latLng(loc.bbox.slice(2, 4).reverse())); - } - else - { - latLngBounds = L.latLngBounds(latLng, latLng); - } - results[i] = { - name: loc.place_name, - bbox: latLngBounds, - center: latLng - }; - } - } + this._requestCount = 0; + }, - cb.call(context, results); - }); - }, + onAdd: function(map) { + var className = 'leaflet-control-geocoder', + container = L.DomUtil.create('div', className + ' leaflet-bar'), + icon = L.DomUtil.create('button', className + '-icon', container), + form = (this._form = L.DomUtil.create('div', className + '-form', container)), + input; - suggest: function(query, cb, context) { - return this.geocode(query, cb, context); - }, + this._map = map; + this._container = container; - reverse: function(location, scale, cb, context) { - Util.getJSON(this.options.serviceUrl + encodeURIComponent(location.lng) + ',' + encodeURIComponent(location.lat) + '.json', this.options.reverseQueryParams, function(data) { - var results = [], - loc, - latLng, - latLngBounds; - if (data.features && data.features.length) { - for (var i = 0; i <= data.features.length - 1; i++) { - loc = data.features[i]; - latLng = L.latLng(loc.center.reverse()); - if (loc.hasOwnProperty('bbox')) - { - latLngBounds = L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()), L.latLng(loc.bbox.slice(2, 4).reverse())); - } - else - { - latLngBounds = L.latLngBounds(latLng, latLng); - } - results[i] = { - name: loc.place_name, - bbox: latLngBounds, - center: latLng - }; - } - } + icon.innerHTML = ' '; + icon.type = 'button'; - cb.call(context, results); - }); - } - }), + input = this._input = L.DomUtil.create('input', '', form); + input.type = 'text'; + input.placeholder = this.options.placeholder; - factory: function(accessToken, options) { - return new L.Control.Geocoder.Mapbox(accessToken, options); - } + this._errorElement = L.DomUtil.create('div', className + '-form-no-error', container); + this._errorElement.innerHTML = this.options.errorMessage; + + this._alts = L.DomUtil.create( + 'ul', + className + '-alternatives leaflet-control-geocoder-alternatives-minimized', + container + ); + L.DomEvent.disableClickPropagation(this._alts); + + L.DomEvent.addListener(input, 'keydown', this._keydown, this); + if (this.options.geocoder.suggest) { + L.DomEvent.addListener(input, 'input', this._change, this); + } + L.DomEvent.addListener( + input, + 'blur', + function() { + if (this.options.collapsed && !this._preventBlurCollapse) { + this._collapse(); + } + this._preventBlurCollapse = false; + }, + this + ); + + if (this.options.collapsed) { + if (this.options.expand === 'click') { + L.DomEvent.addListener( + container, + 'click', + function(e) { + if (e.button === 0 && e.detail !== 2) { + this._toggle(); + } + }, + this + ); + } else if (L.Browser.touch && this.options.expand === 'touch') { + L.DomEvent.addListener( + container, + 'touchstart mousedown', + function(e) { + this._toggle(); + e.preventDefault(); // mobile: clicking focuses the icon, so UI expands and immediately collapses + e.stopPropagation(); + }, + this + ); + } else { + L.DomEvent.addListener(container, 'mouseover', this._expand, this); + L.DomEvent.addListener(container, 'mouseout', this._collapse, this); + this._map.on('movestart', this._collapse, this); + } + } else { + this._expand(); + if (L.Browser.touch) { + L.DomEvent.addListener( + container, + 'touchstart', + function() { + this._geocode(); + }, + this + ); + } else { + L.DomEvent.addListener( + container, + 'click', + function() { + this._geocode(); + }, + this + ); + } + } + + if (this.options.defaultMarkGeocode) { + this.on('markgeocode', this.markGeocode, this); + } + + this.on( + 'startgeocode', + function() { + L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber'); + }, + this + ); + this.on( + 'finishgeocode', + function() { + L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber'); + }, + this + ); + + L.DomEvent.disableClickPropagation(container); + + return container; + }, + + _geocodeResult: function(results, suggest) { + if (!suggest && results.length === 1) { + this._geocodeResultSelected(results[0]); + } else if (results.length > 0) { + this._alts.innerHTML = ''; + this._results = results; + L.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); + for (var i = 0; i < results.length; i++) { + this._alts.appendChild(this._createAlt(results[i], i)); + } + } else { + L.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error'); + } + }, + + markGeocode: function(result) { + result = result.geocode || result; + + this._map.fitBounds(result.bbox); + + if (this._geocodeMarker) { + this._map.removeLayer(this._geocodeMarker); + } + + this._geocodeMarker = new L.Marker(result.center) + .bindPopup(result.html || result.name) + .addTo(this._map) + .openPopup(); + + return this; + }, + + _geocode: function(suggest) { + var requestCount = ++this._requestCount, + mode = suggest ? 'suggest' : 'geocode', + eventData = { input: this._input.value }; + + this._lastGeocode = this._input.value; + if (!suggest) { + this._clearResults(); + } + + this.fire('start' + mode, eventData); + this.options.geocoder[mode]( + this._input.value, + function(results) { + if (requestCount === this._requestCount) { + eventData.results = results; + this.fire('finish' + mode, eventData); + this._geocodeResult(results, suggest); + } + }, + this + ); + }, + + _geocodeResultSelected: function(result) { + this.fire('markgeocode', { geocode: result }); + }, + + _toggle: function() { + if (L.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) { + this._collapse(); + } else { + this._expand(); + } + }, + + _expand: function() { + L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded'); + this._input.select(); + this.fire('expand'); + }, + + _collapse: function() { + L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded'); + L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); + L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); + this._input.blur(); // mobile: keyboard shouldn't stay expanded + this.fire('collapse'); + }, + + _clearResults: function() { + L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); + this._selection = null; + L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); + }, + + _createAlt: function(result, index) { + var li = L.DomUtil.create('li', ''), + a = L.DomUtil.create('a', '', li), + icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null, + text = result.html ? undefined : document.createTextNode(result.name), + mouseDownHandler = function mouseDownHandler(e) { + // In some browsers, a click will fire on the map if the control is + // collapsed directly after mousedown. To work around this, we + // wait until the click is completed, and _then_ collapse the + // control. Messy, but this is the workaround I could come up with + // for #142. + this._preventBlurCollapse = true; + L.DomEvent.stop(e); + this._geocodeResultSelected(result); + L.DomEvent.on( + li, + 'click', + function() { + if (this.options.collapsed) { + this._collapse(); + } else { + this._clearResults(); + } + }, + this + ); + }; + + if (icon) { + icon.src = result.icon; + } + + li.setAttribute('data-result-index', index); + + if (result.html) { + a.innerHTML = a.innerHTML + result.html; + } else { + a.appendChild(text); + } + + // Use mousedown and not click, since click will fire _after_ blur, + // causing the control to have collapsed and removed the items + // before the click can fire. + L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this); + + return li; + }, + + _keydown: function(e) { + var _this = this, + select = function select(dir) { + if (_this._selection) { + L.DomUtil.removeClass(_this._selection, 'leaflet-control-geocoder-selected'); + _this._selection = _this._selection[dir > 0 ? 'nextSibling' : 'previousSibling']; + } + if (!_this._selection) { + _this._selection = _this._alts[dir > 0 ? 'firstChild' : 'lastChild']; + } + + if (_this._selection) { + L.DomUtil.addClass(_this._selection, 'leaflet-control-geocoder-selected'); + } + }; + + switch (e.keyCode) { + // Escape + case 27: + if (this.options.collapsed) { + this._collapse(); + } + break; + // Up + case 38: + select(-1); + break; + // Up + case 40: + select(1); + break; + // Enter + case 13: + if (this._selection) { + var index = parseInt(this._selection.getAttribute('data-result-index'), 10); + this._geocodeResultSelected(this._results[index]); + this._clearResults(); + } else { + this._geocode(); + } + break; + } + }, + _change: function() { + var v = this._input.value; + if (v !== this._lastGeocode) { + clearTimeout(this._suggestTimeout); + if (v.length >= this.options.suggestMinLength) { + this._suggestTimeout = setTimeout( + L.bind(function() { + this._geocode(true); + }, this), + this.options.suggestTimeout + ); + } else { + this._clearResults(); + } + } + } + }), + factory: function(options) { + return new L.Control.Geocoder(options); + } }; +var Bing = { + class: L.Class.extend({ + initialize: function(key) { + this.key = key; + }, -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],7:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); + geocode: function(query, cb, context) { + jsonp( + 'https://dev.virtualearth.net/REST/v1/Locations', + { + query: query, + key: this.key + }, + function(data) { + var results = []; + if (data.resourceSets.length > 0) { + for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) { + var resource = data.resourceSets[0].resources[i], + bbox = resource.bbox; + results[i] = { + name: resource.name, + bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), + center: L.latLng(resource.point.coordinates) + }; + } + } + cb.call(context, results); + }, + this, + 'jsonp' + ); + }, -module.exports = { - "class": L.Class.extend({ - options: { - serviceUrl: 'https://www.mapquestapi.com/geocoding/v1' - }, + reverse: function(location, scale, cb, context) { + jsonp( + '//dev.virtualearth.net/REST/v1/Locations/' + location.lat + ',' + location.lng, + { + key: this.key + }, + function(data) { + var results = []; + for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) { + var resource = data.resourceSets[0].resources[i], + bbox = resource.bbox; + results[i] = { + name: resource.name, + bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), + center: L.latLng(resource.point.coordinates) + }; + } + cb.call(context, results); + }, + this, + 'jsonp' + ); + } + }), - initialize: function(key, options) { - // MapQuest seems to provide URI encoded API keys, - // so to avoid encoding them twice, we decode them here - this._key = decodeURIComponent(key); - - L.Util.setOptions(this, options); - }, - - _formatName: function() { - var r = [], - i; - for (i = 0; i < arguments.length; i++) { - if (arguments[i]) { - r.push(arguments[i]); - } - } - - return r.join(', '); - }, - - geocode: function(query, cb, context) { - Util.jsonp(this.options.serviceUrl + '/address', { - key: this._key, - location: query, - limit: 5, - outFormat: 'json' - }, function(data) { - var results = [], - loc, - latLng; - if (data.results && data.results[0].locations) { - for (var i = data.results[0].locations.length - 1; i >= 0; i--) { - loc = data.results[0].locations[i]; - latLng = L.latLng(loc.latLng); - results[i] = { - name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), - bbox: L.latLngBounds(latLng, latLng), - center: latLng - }; - } - } - - cb.call(context, results); - }, this); - }, - - reverse: function(location, scale, cb, context) { - Util.jsonp(this.options.serviceUrl + '/reverse', { - key: this._key, - location: location.lat + ',' + location.lng, - outputFormat: 'json' - }, function(data) { - var results = [], - loc, - latLng; - if (data.results && data.results[0].locations) { - for (var i = data.results[0].locations.length - 1; i >= 0; i--) { - loc = data.results[0].locations[i]; - latLng = L.latLng(loc.latLng); - results[i] = { - name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), - bbox: L.latLngBounds(latLng, latLng), - center: latLng - }; - } - } - - cb.call(context, results); - }, this); - } - }), - - factory: function(key, options) { - return new L.Control.Geocoder.MapQuest(key, options); - } + factory: function(key) { + return new L.Control.Geocoder.Bing(key); + } }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],8:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); +var MapQuest = { + class: L.Class.extend({ + options: { + serviceUrl: 'https://www.mapquestapi.com/geocoding/v1' + }, -module.exports = { - "class": L.Class.extend({ - options: { - serviceUrl: 'https://search.mapzen.com/v1', - geocodingQueryParams: {}, - reverseQueryParams: {} - }, + initialize: function(key, options) { + // MapQuest seems to provide URI encoded API keys, + // so to avoid encoding them twice, we decode them here + this._key = decodeURIComponent(key); - initialize: function(apiKey, options) { - L.Util.setOptions(this, options); - this._apiKey = apiKey; - this._lastSuggest = 0; - }, + L.Util.setOptions(this, options); + }, - geocode: function(query, cb, context) { - var _this = this; - Util.getJSON(this.options.serviceUrl + "/search", L.extend({ - 'api_key': this._apiKey, - 'text': query - }, this.options.geocodingQueryParams), function(data) { - cb.call(context, _this._parseResults(data, "bbox")); - }); - }, + _formatName: function() { + var r = [], + i; + for (i = 0; i < arguments.length; i++) { + if (arguments[i]) { + r.push(arguments[i]); + } + } - suggest: function(query, cb, context) { - var _this = this; - Util.getJSON(this.options.serviceUrl + "/autocomplete", L.extend({ - 'api_key': this._apiKey, - 'text': query - }, this.options.geocodingQueryParams), L.bind(function(data) { - if (data.geocoding.timestamp > this._lastSuggest) { - this._lastSuggest = data.geocoding.timestamp; - cb.call(context, _this._parseResults(data, "bbox")); - } - }, this)); - }, + return r.join(', '); + }, - reverse: function(location, scale, cb, context) { - var _this = this; - Util.getJSON(this.options.serviceUrl + "/reverse", L.extend({ - 'api_key': this._apiKey, - 'point.lat': location.lat, - 'point.lon': location.lng - }, this.options.reverseQueryParams), function(data) { - cb.call(context, _this._parseResults(data, "bounds")); - }); - }, + geocode: function(query, cb, context) { + getJSON( + this.options.serviceUrl + '/address', + { + key: this._key, + location: query, + limit: 5, + outFormat: 'json' + }, + L.bind(function(data) { + var results = [], + loc, + latLng; + if (data.results && data.results[0].locations) { + for (var i = data.results[0].locations.length - 1; i >= 0; i--) { + loc = data.results[0].locations[i]; + latLng = L.latLng(loc.latLng); + results[i] = { + name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), + bbox: L.latLngBounds(latLng, latLng), + center: latLng + }; + } + } - _parseResults: function(data, bboxname) { - var results = []; - L.geoJson(data, { - pointToLayer: function (feature, latlng) { - return L.circleMarker(latlng); - }, - onEachFeature: function(feature, layer) { - var result = {}, - bbox, - center; + cb.call(context, results); + }, this) + ); + }, - if (layer.getBounds) { - bbox = layer.getBounds(); - center = bbox.getCenter(); - } else { - center = layer.getLatLng(); - bbox = L.latLngBounds(center, center); - } + reverse: function(location, scale, cb, context) { + getJSON( + this.options.serviceUrl + '/reverse', + { + key: this._key, + location: location.lat + ',' + location.lng, + outputFormat: 'json' + }, + L.bind(function(data) { + var results = [], + loc, + latLng; + if (data.results && data.results[0].locations) { + for (var i = data.results[0].locations.length - 1; i >= 0; i--) { + loc = data.results[0].locations[i]; + latLng = L.latLng(loc.latLng); + results[i] = { + name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), + bbox: L.latLngBounds(latLng, latLng), + center: latLng + }; + } + } - result.name = layer.feature.properties.label; - result.center = center; - result[bboxname] = bbox; - result.properties = layer.feature.properties; - results.push(result); - } - }); - return results; - } - }), + cb.call(context, results); + }, this) + ); + } + }), - factory: function(apiKey, options) { - return new L.Control.Geocoder.Mapzen(apiKey, options); - } + factory: function(key, options) { + return new L.Control.Geocoder.MapQuest(key, options); + } }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],9:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); +var Mapbox = { + class: L.Class.extend({ + options: { + serviceUrl: 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places-v1/', + geocodingQueryParams: {}, + reverseQueryParams: {} + }, -module.exports = { - "class": L.Class.extend({ - options: { - serviceUrl: 'https://nominatim.openstreetmap.org/', - geocodingQueryParams: {}, - reverseQueryParams: {}, - htmlTemplate: function(r) { - var a = r.address, - parts = []; - if (a.road || a.building) { - parts.push('{building} {road} {house_number}'); - } + initialize: function(accessToken, options) { + L.setOptions(this, options); + this.options.geocodingQueryParams.access_token = accessToken; + this.options.reverseQueryParams.access_token = accessToken; + }, - if (a.city || a.town || a.village || a.hamlet) { - parts.push('{postcode} {city} {town} {village} {hamlet}'); - } + geocode: function(query, cb, context) { + var params = this.options.geocodingQueryParams; + if ( + typeof params.proximity !== 'undefined' && + params.proximity.hasOwnProperty('lat') && + params.proximity.hasOwnProperty('lng') + ) { + params.proximity = params.proximity.lng + ',' + params.proximity.lat; + } + getJSON(this.options.serviceUrl + encodeURIComponent(query) + '.json', params, function( + data + ) { + var results = [], + loc, + latLng, + latLngBounds; + if (data.features && data.features.length) { + for (var i = 0; i <= data.features.length - 1; i++) { + loc = data.features[i]; + latLng = L.latLng(loc.center.reverse()); + if (loc.hasOwnProperty('bbox')) { + latLngBounds = L.latLngBounds( + L.latLng(loc.bbox.slice(0, 2).reverse()), + L.latLng(loc.bbox.slice(2, 4).reverse()) + ); + } else { + latLngBounds = L.latLngBounds(latLng, latLng); + } + results[i] = { + name: loc.place_name, + bbox: latLngBounds, + center: latLng + }; + } + } - if (a.state || a.country) { - parts.push('{state} {country}'); - } + cb.call(context, results); + }); + }, - return Util.template(parts.join('
'), a, true); - } - }, + suggest: function(query, cb, context) { + return this.geocode(query, cb, context); + }, - initialize: function(options) { - L.Util.setOptions(this, options); - }, + reverse: function(location, scale, cb, context) { + getJSON( + this.options.serviceUrl + + encodeURIComponent(location.lng) + + ',' + + encodeURIComponent(location.lat) + + '.json', + this.options.reverseQueryParams, + function(data) { + var results = [], + loc, + latLng, + latLngBounds; + if (data.features && data.features.length) { + for (var i = 0; i <= data.features.length - 1; i++) { + loc = data.features[i]; + latLng = L.latLng(loc.center.reverse()); + if (loc.hasOwnProperty('bbox')) { + latLngBounds = L.latLngBounds( + L.latLng(loc.bbox.slice(0, 2).reverse()), + L.latLng(loc.bbox.slice(2, 4).reverse()) + ); + } else { + latLngBounds = L.latLngBounds(latLng, latLng); + } + results[i] = { + name: loc.place_name, + bbox: latLngBounds, + center: latLng + }; + } + } - geocode: function(query, cb, context) { - Util.jsonp(this.options.serviceUrl + 'search', L.extend({ - q: query, - limit: 5, - format: 'json', - addressdetails: 1 - }, this.options.geocodingQueryParams), - function(data) { - var results = []; - for (var i = data.length - 1; i >= 0; i--) { - var bbox = data[i].boundingbox; - for (var j = 0; j < 4; j++) bbox[j] = parseFloat(bbox[j]); - results[i] = { - icon: data[i].icon, - name: data[i].display_name, - html: this.options.htmlTemplate ? - this.options.htmlTemplate(data[i]) - : undefined, - bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]), - center: L.latLng(data[i].lat, data[i].lon), - properties: data[i] - }; - } - cb.call(context, results); - }, this, 'json_callback'); - }, + cb.call(context, results); + } + ); + } + }), - reverse: function(location, scale, cb, context) { - Util.jsonp(this.options.serviceUrl + 'reverse', L.extend({ - lat: location.lat, - lon: location.lng, - zoom: Math.round(Math.log(scale / 256) / Math.log(2)), - addressdetails: 1, - format: 'json' - }, this.options.reverseQueryParams), function(data) { - var result = [], - loc; - - if (data && data.lat && data.lon) { - loc = L.latLng(data.lat, data.lon); - result.push({ - name: data.display_name, - html: this.options.htmlTemplate ? - this.options.htmlTemplate(data) - : undefined, - center: loc, - bounds: L.latLngBounds(loc, loc), - properties: data - }); - } - - cb.call(context, result); - }, this, 'json_callback'); - } - }), - - factory: function(options) { - return new L.Control.Geocoder.Nominatim(options); - } + factory: function(accessToken, options) { + return new L.Control.Geocoder.Mapbox(accessToken, options); + } }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],10:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); +var What3Words = { + class: L.Class.extend({ + options: { + serviceUrl: 'https://api.what3words.com/v2/' + }, -module.exports = { - "class": L.Class.extend({ - options: { - serviceUrl: 'https://photon.komoot.de/api/', - reverseUrl: 'https://photon.komoot.de/reverse/', - nameProperties: [ - 'name', - 'street', - 'suburb', - 'hamlet', - 'town', - 'city', - 'state', - 'country' - ] - }, + initialize: function(accessToken) { + this._accessToken = accessToken; + }, - initialize: function(options) { - L.setOptions(this, options); - }, + geocode: function(query, cb, context) { + //get three words and make a dot based string + getJSON( + this.options.serviceUrl + 'forward', + { + key: this._accessToken, + addr: query.split(/\s+/).join('.') + }, + function(data) { + var results = [], + latLng, + latLngBounds; + if (data.hasOwnProperty('geometry')) { + latLng = L.latLng(data.geometry['lat'], data.geometry['lng']); + latLngBounds = L.latLngBounds(latLng, latLng); + results[0] = { + name: data.words, + bbox: latLngBounds, + center: latLng + }; + } - geocode: function(query, cb, context) { - var params = L.extend({ - q: query - }, this.options.geocodingQueryParams); + cb.call(context, results); + } + ); + }, - Util.getJSON(this.options.serviceUrl, params, L.bind(function(data) { - cb.call(context, this._decodeFeatures(data)); - }, this)); - }, + suggest: function(query, cb, context) { + return this.geocode(query, cb, context); + }, - suggest: function(query, cb, context) { - return this.geocode(query, cb, context); - }, + reverse: function(location, scale, cb, context) { + getJSON( + this.options.serviceUrl + 'reverse', + { + key: this._accessToken, + coords: [location.lat, location.lng].join(',') + }, + function(data) { + var results = [], + latLng, + latLngBounds; + if (data.status.status == 200) { + latLng = L.latLng(data.geometry['lat'], data.geometry['lng']); + latLngBounds = L.latLngBounds(latLng, latLng); + results[0] = { + name: data.words, + bbox: latLngBounds, + center: latLng + }; + } + cb.call(context, results); + } + ); + } + }), - reverse: function(latLng, scale, cb, context) { - var params = L.extend({ - lat: latLng.lat, - lon: latLng.lng - }, this.options.geocodingQueryParams); - - Util.getJSON(this.options.reverseUrl, params, L.bind(function(data) { - cb.call(context, this._decodeFeatures(data)); - }, this)); - }, - - _decodeFeatures: function(data) { - var results = [], - i, - f, - c, - latLng, - extent, - bbox; - - if (data && data.features) { - for (i = 0; i < data.features.length; i++) { - f = data.features[i]; - c = f.geometry.coordinates; - latLng = L.latLng(c[1], c[0]); - extent = f.properties.extent; - - if (extent) { - bbox = L.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]); - } else { - bbox = L.latLngBounds(latLng, latLng); - } - - results.push({ - name: this._deocodeFeatureName(f), - html: this.options.htmlTemplate ? - this.options.htmlTemplate(f) - : undefined, - center: latLng, - bbox: bbox, - properties: f.properties - }); - } - } - - return results; - }, - - _deocodeFeatureName: function(f) { - var j, - name; - for (j = 0; !name && j < this.options.nameProperties.length; j++) { - name = f.properties[this.options.nameProperties[j]]; - } - - return name; - } - }), - - factory: function(options) { - return new L.Control.Geocoder.Photon(options); - } + factory: function(accessToken) { + return new L.Control.Geocoder.What3Words(accessToken); + } }; +var Google = { + class: L.Class.extend({ + options: { + serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json', + geocodingQueryParams: {}, + reverseQueryParams: {} + }, -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],11:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Util = _dereq_('../util'); + initialize: function(key, options) { + this._key = key; + L.setOptions(this, options); + // Backwards compatibility + this.options.serviceUrl = this.options.service_url || this.options.serviceUrl; + }, -module.exports = { - "class": L.Class.extend({ - options: { - serviceUrl: 'https://api.what3words.com/v2/' - }, + geocode: function(query, cb, context) { + var params = { + address: query + }; - initialize: function(accessToken) { - this._accessToken = accessToken; - }, + if (this._key && this._key.length) { + params.key = this._key; + } - geocode: function(query, cb, context) { - //get three words and make a dot based string - Util.getJSON(this.options.serviceUrl +'forward', { - key: this._accessToken, - addr: query.split(/\s+/).join('.') - }, function(data) { - var results = [], loc, latLng, latLngBounds; - if (data.hasOwnProperty('geometry')) { - latLng = L.latLng(data.geometry['lat'],data.geometry['lng']); - latLngBounds = L.latLngBounds(latLng, latLng); - results[0] = { - name: data.words, - bbox: latLngBounds, - center: latLng - }; - } + params = L.Util.extend(params, this.options.geocodingQueryParams); - cb.call(context, results); - }); - }, + getJSON(this.options.serviceUrl, params, function(data) { + var results = [], + loc, + latLng, + latLngBounds; + if (data.results && data.results.length) { + for (var i = 0; i <= data.results.length - 1; i++) { + loc = data.results[i]; + latLng = L.latLng(loc.geometry.location); + latLngBounds = L.latLngBounds( + L.latLng(loc.geometry.viewport.northeast), + L.latLng(loc.geometry.viewport.southwest) + ); + results[i] = { + name: loc.formatted_address, + bbox: latLngBounds, + center: latLng, + properties: loc.address_components + }; + } + } - suggest: function(query, cb, context) { - return this.geocode(query, cb, context); - }, + cb.call(context, results); + }); + }, - reverse: function(location, scale, cb, context) { - Util.getJSON(this.options.serviceUrl +'reverse', { - key: this._accessToken, - coords: [location.lat,location.lng].join(',') - }, function(data) { - var results = [],loc,latLng,latLngBounds; - if (data.status.status == 200) { - latLng = L.latLng(data.geometry['lat'],data.geometry['lng']); - latLngBounds = L.latLngBounds(latLng, latLng); - results[0] = { - name: data.words, - bbox: latLngBounds, - center: latLng - }; - } - cb.call(context, results); - }); - } - }), + reverse: function(location, scale, cb, context) { + var params = { + latlng: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng) + }; + params = L.Util.extend(params, this.options.reverseQueryParams); + if (this._key && this._key.length) { + params.key = this._key; + } - factory: function(accessToken) { - return new L.Control.Geocoder.What3Words(accessToken); - } + getJSON(this.options.serviceUrl, params, function(data) { + var results = [], + loc, + latLng, + latLngBounds; + if (data.results && data.results.length) { + for (var i = 0; i <= data.results.length - 1; i++) { + loc = data.results[i]; + latLng = L.latLng(loc.geometry.location); + latLngBounds = L.latLngBounds( + L.latLng(loc.geometry.viewport.northeast), + L.latLng(loc.geometry.viewport.southwest) + ); + results[i] = { + name: loc.formatted_address, + bbox: latLngBounds, + center: latLng, + properties: loc.address_components + }; + } + } + + cb.call(context, results); + }); + } + }), + + factory: function(key, options) { + return new L.Control.Geocoder.Google(key, options); + } }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../util":13}],12:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - Control = _dereq_('./control'), - Nominatim = _dereq_('./geocoders/nominatim'), - Bing = _dereq_('./geocoders/bing'), - MapQuest = _dereq_('./geocoders/mapquest'), - Mapbox = _dereq_('./geocoders/mapbox'), - What3Words = _dereq_('./geocoders/what3words'), - Google = _dereq_('./geocoders/google'), - Photon = _dereq_('./geocoders/photon'), - Mapzen = _dereq_('./geocoders/mapzen'), - ArcGis = _dereq_('./geocoders/arcgis'), - HERE = _dereq_('./geocoders/here'); +var Photon = { + class: L.Class.extend({ + options: { + serviceUrl: 'https://photon.komoot.de/api/', + reverseUrl: 'https://photon.komoot.de/reverse/', + nameProperties: ['name', 'street', 'suburb', 'hamlet', 'town', 'city', 'state', 'country'] + }, -module.exports = L.Util.extend(Control["class"], { - Nominatim: Nominatim["class"], - nominatim: Nominatim.factory, - Bing: Bing["class"], - bing: Bing.factory, - MapQuest: MapQuest["class"], - mapQuest: MapQuest.factory, - Mapbox: Mapbox["class"], - mapbox: Mapbox.factory, - What3Words: What3Words["class"], - what3words: What3Words.factory, - Google: Google["class"], - google: Google.factory, - Photon: Photon["class"], - photon: Photon.factory, - Mapzen: Mapzen["class"], - mapzen: Mapzen.factory, - ArcGis: ArcGis["class"], - arcgis: ArcGis.factory, - HERE: HERE["class"], - here: HERE.factory + initialize: function(options) { + L.setOptions(this, options); + }, + + geocode: function(query, cb, context) { + var params = L.extend( + { + q: query + }, + this.options.geocodingQueryParams + ); + + getJSON( + this.options.serviceUrl, + params, + L.bind(function(data) { + cb.call(context, this._decodeFeatures(data)); + }, this) + ); + }, + + suggest: function(query, cb, context) { + return this.geocode(query, cb, context); + }, + + reverse: function(latLng, scale, cb, context) { + var params = L.extend( + { + lat: latLng.lat, + lon: latLng.lng + }, + this.options.reverseQueryParams + ); + + getJSON( + this.options.reverseUrl, + params, + L.bind(function(data) { + cb.call(context, this._decodeFeatures(data)); + }, this) + ); + }, + + _decodeFeatures: function(data) { + var results = [], + i, + f, + c, + latLng, + extent, + bbox; + + if (data && data.features) { + for (i = 0; i < data.features.length; i++) { + f = data.features[i]; + c = f.geometry.coordinates; + latLng = L.latLng(c[1], c[0]); + extent = f.properties.extent; + + if (extent) { + bbox = L.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]); + } else { + bbox = L.latLngBounds(latLng, latLng); + } + + results.push({ + name: this._deocodeFeatureName(f), + html: this.options.htmlTemplate ? this.options.htmlTemplate(f) : undefined, + center: latLng, + bbox: bbox, + properties: f.properties + }); + } + } + + return results; + }, + + _deocodeFeatureName: function(f) { + var j, name; + for (j = 0; !name && j < this.options.nameProperties.length; j++) { + name = f.properties[this.options.nameProperties[j]]; + } + + return name; + } + }), + + factory: function(options) { + return new L.Control.Geocoder.Photon(options); + } +}; + +var Mapzen = { + class: L.Class.extend({ + options: { + serviceUrl: 'https://search.mapzen.com/v1', + geocodingQueryParams: {}, + reverseQueryParams: {} + }, + + initialize: function(apiKey, options) { + L.Util.setOptions(this, options); + this._apiKey = apiKey; + this._lastSuggest = 0; + }, + + geocode: function(query, cb, context) { + var _this = this; + getJSON( + this.options.serviceUrl + '/search', + L.extend( + { + api_key: this._apiKey, + text: query + }, + this.options.geocodingQueryParams + ), + function(data) { + cb.call(context, _this._parseResults(data, 'bbox')); + } + ); + }, + + suggest: function(query, cb, context) { + var _this = this; + getJSON( + this.options.serviceUrl + '/autocomplete', + L.extend( + { + api_key: this._apiKey, + text: query + }, + this.options.geocodingQueryParams + ), + L.bind(function(data) { + if (data.geocoding.timestamp > this._lastSuggest) { + this._lastSuggest = data.geocoding.timestamp; + cb.call(context, _this._parseResults(data, 'bbox')); + } + }, this) + ); + }, + + reverse: function(location, scale, cb, context) { + var _this = this; + getJSON( + this.options.serviceUrl + '/reverse', + L.extend( + { + api_key: this._apiKey, + 'point.lat': location.lat, + 'point.lon': location.lng + }, + this.options.reverseQueryParams + ), + function(data) { + cb.call(context, _this._parseResults(data, 'bounds')); + } + ); + }, + + _parseResults: function(data, bboxname) { + var results = []; + L.geoJson(data, { + pointToLayer: function(feature, latlng) { + return L.circleMarker(latlng); + }, + onEachFeature: function(feature, layer) { + var result = {}, + bbox, + center; + + if (layer.getBounds) { + bbox = layer.getBounds(); + center = bbox.getCenter(); + } else { + center = layer.getLatLng(); + bbox = L.latLngBounds(center, center); + } + + result.name = layer.feature.properties.label; + result.center = center; + result[bboxname] = bbox; + result.properties = layer.feature.properties; + results.push(result); + } + }); + return results; + } + }), + + factory: function(apiKey, options) { + return new L.Control.Geocoder.Mapzen(apiKey, options); + } +}; + +var ArcGis = { + class: L.Class.extend({ + options: { + service_url: 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer' + }, + + initialize: function(accessToken, options) { + L.setOptions(this, options); + this._accessToken = accessToken; + }, + + geocode: function(query, cb, context) { + var params = { + SingleLine: query, + outFields: 'Addr_Type', + forStorage: false, + maxLocations: 10, + f: 'json' + }; + + if (this._key && this._key.length) { + params.token = this._key; + } + + getJSON(this.options.service_url + '/findAddressCandidates', params, function(data) { + var results = [], + loc, + latLng, + latLngBounds; + + if (data.candidates && data.candidates.length) { + for (var i = 0; i <= data.candidates.length - 1; i++) { + loc = data.candidates[i]; + latLng = L.latLng(loc.location.y, loc.location.x); + latLngBounds = L.latLngBounds( + L.latLng(loc.extent.ymax, loc.extent.xmax), + L.latLng(loc.extent.ymin, loc.extent.xmin) + ); + results[i] = { + name: loc.address, + bbox: latLngBounds, + center: latLng + }; + } + } + + cb.call(context, results); + }); + }, + + suggest: function(query, cb, context) { + return this.geocode(query, cb, context); + }, + + reverse: function(location, scale, cb, context) { + var params = { + location: encodeURIComponent(location.lng) + ',' + encodeURIComponent(location.lat), + distance: 100, + f: 'json' + }; + + getJSON(this.options.service_url + '/reverseGeocode', params, function(data) { + var result = [], + loc; + + if (data && !data.error) { + loc = L.latLng(data.location.y, data.location.x); + result.push({ + name: data.address.Match_addr, + center: loc, + bounds: L.latLngBounds(loc, loc) + }); + } + + cb.call(context, result); + }); + } + }), + + factory: function(accessToken, options) { + return new L.Control.Geocoder.ArcGis(accessToken, options); + } +}; + +var HERE = { + class: L.Class.extend({ + options: { + geocodeUrl: 'http://geocoder.api.here.com/6.2/geocode.json', + reverseGeocodeUrl: 'http://reverse.geocoder.api.here.com/6.2/reversegeocode.json', + app_id: '', + app_code: '', + geocodingQueryParams: {}, + reverseQueryParams: {} + }, + + initialize: function(options) { + L.setOptions(this, options); + }, + + geocode: function(query, cb, context) { + var params = { + searchtext: query, + gen: 9, + app_id: this.options.app_id, + app_code: this.options.app_code, + jsonattributes: 1 + }; + params = L.Util.extend(params, this.options.geocodingQueryParams); + this.getJSON(this.options.geocodeUrl, params, cb, context); + }, + + reverse: function(location, scale, cb, context) { + var params = { + prox: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng), + mode: 'retrieveAddresses', + app_id: this.options.app_id, + app_code: this.options.app_code, + gen: 9, + jsonattributes: 1 + }; + params = L.Util.extend(params, this.options.reverseQueryParams); + this.getJSON(this.options.reverseGeocodeUrl, params, cb, context); + }, + + getJSON: function(url, params, cb, context) { + getJSON(url, params, function(data) { + var results = [], + loc, + latLng, + latLngBounds; + if (data.response.view && data.response.view.length) { + for (var i = 0; i <= data.response.view[0].result.length - 1; i++) { + loc = data.response.view[0].result[i].location; + latLng = L.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude); + latLngBounds = L.latLngBounds( + L.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude), + L.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude) + ); + results[i] = { + name: loc.address.label, + bbox: latLngBounds, + center: latLng + }; + } + } + cb.call(context, results); + }); + } + }), + + factory: function(options) { + return new L.Control.Geocoder.HERE(options); + } +}; + +var Geocoder = L.Util.extend(Control.class, { + Nominatim: Nominatim.class, + nominatim: Nominatim.factory, + Bing: Bing.class, + bing: Bing.factory, + MapQuest: MapQuest.class, + mapQuest: MapQuest.factory, + Mapbox: Mapbox.class, + mapbox: Mapbox.factory, + What3Words: What3Words.class, + what3words: What3Words.factory, + Google: Google.class, + google: Google.factory, + Photon: Photon.class, + photon: Photon.factory, + Mapzen: Mapzen.class, + mapzen: Mapzen.factory, + ArcGis: ArcGis.class, + arcgis: ArcGis.factory, + HERE: HERE.class, + here: HERE.factory }); L.Util.extend(L.Control, { - Geocoder: module.exports, - geocoder: Control.factory + Geocoder: Geocoder, + geocoder: Control.factory }); -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./control":1,"./geocoders/arcgis":2,"./geocoders/bing":3,"./geocoders/google":4,"./geocoders/here":5,"./geocoders/mapbox":6,"./geocoders/mapquest":7,"./geocoders/mapzen":8,"./geocoders/nominatim":9,"./geocoders/photon":10,"./geocoders/what3words":11}],13:[function(_dereq_,module,exports){ -(function (global){ -var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), - lastCallbackId = 0, - htmlEscape = (function() { - // Adapted from handlebars.js - // https://github.com/wycats/handlebars.js/ - var badChars = /[&<>"'`]/g; - var possible = /[&<>"'`]/; - var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '`': '`' - }; +return Geocoder; - function escapeChar(chr) { - return escape[chr]; - } - - return function(string) { - if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); - }; - })(); - -module.exports = { - jsonp: function(url, params, callback, context, jsonpParam) { - var callbackId = '_l_geocoder_' + (lastCallbackId++); - params[jsonpParam || 'callback'] = callbackId; - window[callbackId] = L.Util.bind(callback, context); - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = url + L.Util.getParamString(params); - script.id = callbackId; - document.getElementsByTagName('head')[0].appendChild(script); - }, - - getJSON: function(url, params, callback) { - var xmlHttp = new XMLHttpRequest(); - xmlHttp.onreadystatechange = function () { - if (xmlHttp.readyState !== 4){ - return; - } - if (xmlHttp.status !== 200 && xmlHttp.status !== 304){ - callback(''); - return; - } - callback(JSON.parse(xmlHttp.response)); - }; - xmlHttp.open('GET', url + L.Util.getParamString(params), true); - xmlHttp.setRequestHeader('Accept', 'application/json'); - xmlHttp.send(null); - }, - - template: function (str, data) { - return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) { - var value = data[key]; - if (value === undefined) { - value = ''; - } else if (typeof value === 'function') { - value = value(data); - } - return htmlEscape(value); - }); - }, - - htmlEscape: htmlEscape -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}]},{},[12])(12) -}); +}(L)); +//# sourceMappingURL=Control.Geocoder.js.map diff --git a/assets/control-geocoder/Control.Geocoder.js.map b/assets/control-geocoder/Control.Geocoder.js.map new file mode 100644 index 0000000..d655362 --- /dev/null +++ b/assets/control-geocoder/Control.Geocoder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Control.Geocoder.js","sources":["../src/util.js","../src/geocoders/nominatim.js","../src/control.js","../src/geocoders/bing.js","../src/geocoders/mapquest.js","../src/geocoders/mapbox.js","../src/geocoders/what3words.js","../src/geocoders/google.js","../src/geocoders/photon.js","../src/geocoders/mapzen.js","../src/geocoders/arcgis.js","../src/geocoders/here.js","../src/index.js"],"sourcesContent":["import L from 'leaflet';\nvar lastCallbackId = 0;\n\n// Adapted from handlebars.js\n// https://github.com/wycats/handlebars.js/\nvar badChars = /[&<>\"'`]/g;\nvar possible = /[&<>\"'`]/;\nvar escape = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n};\n\nfunction escapeChar(chr) {\n return escape[chr];\n}\n\nexport function htmlEscape(string) {\n if (string == null) {\n return '';\n } else if (!string) {\n return string + '';\n }\n\n // Force a string conversion as this will be done by the append regardless and\n // the regex test will do this transparently behind the scenes, causing issues if\n // an object's to string has escaped characters in it.\n string = '' + string;\n\n if (!possible.test(string)) {\n return string;\n }\n return string.replace(badChars, escapeChar);\n}\n\nexport function jsonp(url, params, callback, context, jsonpParam) {\n var callbackId = '_l_geocoder_' + lastCallbackId++;\n params[jsonpParam || 'callback'] = callbackId;\n window[callbackId] = L.Util.bind(callback, context);\n var script = document.createElement('script');\n script.type = 'text/javascript';\n script.src = url + L.Util.getParamString(params);\n script.id = callbackId;\n document.getElementsByTagName('head')[0].appendChild(script);\n}\n\nexport function getJSON(url, params, callback) {\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function() {\n if (xmlHttp.readyState !== 4) {\n return;\n }\n if (xmlHttp.status !== 200 && xmlHttp.status !== 304) {\n callback('');\n return;\n }\n callback(JSON.parse(xmlHttp.response));\n };\n xmlHttp.open('GET', url + L.Util.getParamString(params), true);\n xmlHttp.setRequestHeader('Accept', 'application/json');\n xmlHttp.send(null);\n}\n\nexport function template(str, data) {\n return str.replace(/\\{ *([\\w_]+) *\\}/g, function(str, key) {\n var value = data[key];\n if (value === undefined) {\n value = '';\n } else if (typeof value === 'function') {\n value = value(data);\n }\n return htmlEscape(value);\n });\n}\n","import L from 'leaflet';\nimport { template, getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n serviceUrl: 'https://nominatim.openstreetmap.org/',\n geocodingQueryParams: {},\n reverseQueryParams: {},\n htmlTemplate: function(r) {\n var a = r.address,\n parts = [];\n if (a.road || a.building) {\n parts.push('{building} {road} {house_number}');\n }\n\n if (a.city || a.town || a.village || a.hamlet) {\n parts.push(\n ' 0 ? 'leaflet-control-geocoder-address-detail' : '') +\n '\">{postcode} {city} {town} {village} {hamlet}'\n );\n }\n\n if (a.state || a.country) {\n parts.push(\n ' 0 ? 'leaflet-control-geocoder-address-context' : '') +\n '\">{state} {country}'\n );\n }\n\n return template(parts.join('
'), a, true);\n }\n },\n\n initialize: function(options) {\n L.Util.setOptions(this, options);\n },\n\n geocode: function(query, cb, context) {\n getJSON(\n this.options.serviceUrl + 'search',\n L.extend(\n {\n q: query,\n limit: 5,\n format: 'json',\n addressdetails: 1\n },\n this.options.geocodingQueryParams\n ),\n L.bind(function(data) {\n var results = [];\n for (var i = data.length - 1; i >= 0; i--) {\n var bbox = data[i].boundingbox;\n for (var j = 0; j < 4; j++) bbox[j] = parseFloat(bbox[j]);\n results[i] = {\n icon: data[i].icon,\n name: data[i].display_name,\n html: this.options.htmlTemplate ? this.options.htmlTemplate(data[i]) : undefined,\n bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]),\n center: L.latLng(data[i].lat, data[i].lon),\n properties: data[i]\n };\n }\n cb.call(context, results);\n }, this)\n );\n },\n\n reverse: function(location, scale, cb, context) {\n getJSON(\n this.options.serviceUrl + 'reverse',\n L.extend(\n {\n lat: location.lat,\n lon: location.lng,\n zoom: Math.round(Math.log(scale / 256) / Math.log(2)),\n addressdetails: 1,\n format: 'json'\n },\n this.options.reverseQueryParams\n ),\n L.bind(function(data) {\n var result = [],\n loc;\n\n if (data && data.lat && data.lon) {\n loc = L.latLng(data.lat, data.lon);\n result.push({\n name: data.display_name,\n html: this.options.htmlTemplate ? this.options.htmlTemplate(data) : undefined,\n center: loc,\n bounds: L.latLngBounds(loc, loc),\n properties: data\n });\n }\n\n cb.call(context, result);\n }, this)\n );\n }\n }),\n\n factory: function(options) {\n return new L.Control.Geocoder.Nominatim(options);\n }\n};\n","import L from 'leaflet';\nimport Nominatim from './geocoders/nominatim';\n\nexport default {\n class: L.Control.extend({\n options: {\n showResultIcons: false,\n collapsed: true,\n expand: 'touch', // options: touch, click, anythingelse\n position: 'topright',\n placeholder: 'Search...',\n errorMessage: 'Nothing found.',\n suggestMinLength: 3,\n suggestTimeout: 250,\n defaultMarkGeocode: true\n },\n\n includes: L.Evented.prototype || L.Mixin.Events,\n\n initialize: function(options) {\n L.Util.setOptions(this, options);\n if (!this.options.geocoder) {\n this.options.geocoder = new Nominatim.class();\n }\n\n this._requestCount = 0;\n },\n\n onAdd: function(map) {\n var className = 'leaflet-control-geocoder',\n container = L.DomUtil.create('div', className + ' leaflet-bar'),\n icon = L.DomUtil.create('button', className + '-icon', container),\n form = (this._form = L.DomUtil.create('div', className + '-form', container)),\n input;\n\n this._map = map;\n this._container = container;\n\n icon.innerHTML = ' ';\n icon.type = 'button';\n\n input = this._input = L.DomUtil.create('input', '', form);\n input.type = 'text';\n input.placeholder = this.options.placeholder;\n\n this._errorElement = L.DomUtil.create('div', className + '-form-no-error', container);\n this._errorElement.innerHTML = this.options.errorMessage;\n\n this._alts = L.DomUtil.create(\n 'ul',\n className + '-alternatives leaflet-control-geocoder-alternatives-minimized',\n container\n );\n L.DomEvent.disableClickPropagation(this._alts);\n\n L.DomEvent.addListener(input, 'keydown', this._keydown, this);\n if (this.options.geocoder.suggest) {\n L.DomEvent.addListener(input, 'input', this._change, this);\n }\n L.DomEvent.addListener(\n input,\n 'blur',\n function() {\n if (this.options.collapsed && !this._preventBlurCollapse) {\n this._collapse();\n }\n this._preventBlurCollapse = false;\n },\n this\n );\n\n if (this.options.collapsed) {\n if (this.options.expand === 'click') {\n L.DomEvent.addListener(\n container,\n 'click',\n function(e) {\n if (e.button === 0 && e.detail !== 2) {\n this._toggle();\n }\n },\n this\n );\n } else if (L.Browser.touch && this.options.expand === 'touch') {\n L.DomEvent.addListener(\n container,\n 'touchstart mousedown',\n function(e) {\n this._toggle();\n e.preventDefault(); // mobile: clicking focuses the icon, so UI expands and immediately collapses\n e.stopPropagation();\n },\n this\n );\n } else {\n L.DomEvent.addListener(container, 'mouseover', this._expand, this);\n L.DomEvent.addListener(container, 'mouseout', this._collapse, this);\n this._map.on('movestart', this._collapse, this);\n }\n } else {\n this._expand();\n if (L.Browser.touch) {\n L.DomEvent.addListener(\n container,\n 'touchstart',\n function() {\n this._geocode();\n },\n this\n );\n } else {\n L.DomEvent.addListener(\n container,\n 'click',\n function() {\n this._geocode();\n },\n this\n );\n }\n }\n\n if (this.options.defaultMarkGeocode) {\n this.on('markgeocode', this.markGeocode, this);\n }\n\n this.on(\n 'startgeocode',\n function() {\n L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber');\n },\n this\n );\n this.on(\n 'finishgeocode',\n function() {\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber');\n },\n this\n );\n\n L.DomEvent.disableClickPropagation(container);\n\n return container;\n },\n\n _geocodeResult: function(results, suggest) {\n if (!suggest && results.length === 1) {\n this._geocodeResultSelected(results[0]);\n } else if (results.length > 0) {\n this._alts.innerHTML = '';\n this._results = results;\n L.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');\n for (var i = 0; i < results.length; i++) {\n this._alts.appendChild(this._createAlt(results[i], i));\n }\n } else {\n L.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error');\n }\n },\n\n markGeocode: function(result) {\n result = result.geocode || result;\n\n this._map.fitBounds(result.bbox);\n\n if (this._geocodeMarker) {\n this._map.removeLayer(this._geocodeMarker);\n }\n\n this._geocodeMarker = new L.Marker(result.center)\n .bindPopup(result.html || result.name)\n .addTo(this._map)\n .openPopup();\n\n return this;\n },\n\n _geocode: function(suggest) {\n var requestCount = ++this._requestCount,\n mode = suggest ? 'suggest' : 'geocode',\n eventData = { input: this._input.value };\n\n this._lastGeocode = this._input.value;\n if (!suggest) {\n this._clearResults();\n }\n\n this.fire('start' + mode, eventData);\n this.options.geocoder[mode](\n this._input.value,\n function(results) {\n if (requestCount === this._requestCount) {\n eventData.results = results;\n this.fire('finish' + mode, eventData);\n this._geocodeResult(results, suggest);\n }\n },\n this\n );\n },\n\n _geocodeResultSelected: function(result) {\n this.fire('markgeocode', { geocode: result });\n },\n\n _toggle: function() {\n if (L.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) {\n this._collapse();\n } else {\n this._expand();\n }\n },\n\n _expand: function() {\n L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded');\n this._input.select();\n this.fire('expand');\n },\n\n _collapse: function() {\n L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded');\n L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');\n L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error');\n this._input.blur(); // mobile: keyboard shouldn't stay expanded\n this.fire('collapse');\n },\n\n _clearResults: function() {\n L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');\n this._selection = null;\n L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error');\n },\n\n _createAlt: function(result, index) {\n var li = L.DomUtil.create('li', ''),\n a = L.DomUtil.create('a', '', li),\n icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null,\n text = result.html ? undefined : document.createTextNode(result.name),\n mouseDownHandler = function mouseDownHandler(e) {\n // In some browsers, a click will fire on the map if the control is\n // collapsed directly after mousedown. To work around this, we\n // wait until the click is completed, and _then_ collapse the\n // control. Messy, but this is the workaround I could come up with\n // for #142.\n this._preventBlurCollapse = true;\n L.DomEvent.stop(e);\n this._geocodeResultSelected(result);\n L.DomEvent.on(\n li,\n 'click',\n function() {\n if (this.options.collapsed) {\n this._collapse();\n } else {\n this._clearResults();\n }\n },\n this\n );\n };\n\n if (icon) {\n icon.src = result.icon;\n }\n\n li.setAttribute('data-result-index', index);\n\n if (result.html) {\n a.innerHTML = a.innerHTML + result.html;\n } else {\n a.appendChild(text);\n }\n\n // Use mousedown and not click, since click will fire _after_ blur,\n // causing the control to have collapsed and removed the items\n // before the click can fire.\n L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this);\n\n return li;\n },\n\n _keydown: function(e) {\n var _this = this,\n select = function select(dir) {\n if (_this._selection) {\n L.DomUtil.removeClass(_this._selection, 'leaflet-control-geocoder-selected');\n _this._selection = _this._selection[dir > 0 ? 'nextSibling' : 'previousSibling'];\n }\n if (!_this._selection) {\n _this._selection = _this._alts[dir > 0 ? 'firstChild' : 'lastChild'];\n }\n\n if (_this._selection) {\n L.DomUtil.addClass(_this._selection, 'leaflet-control-geocoder-selected');\n }\n };\n\n switch (e.keyCode) {\n // Escape\n case 27:\n if (this.options.collapsed) {\n this._collapse();\n }\n break;\n // Up\n case 38:\n select(-1);\n break;\n // Up\n case 40:\n select(1);\n break;\n // Enter\n case 13:\n if (this._selection) {\n var index = parseInt(this._selection.getAttribute('data-result-index'), 10);\n this._geocodeResultSelected(this._results[index]);\n this._clearResults();\n } else {\n this._geocode();\n }\n break;\n }\n },\n _change: function() {\n var v = this._input.value;\n if (v !== this._lastGeocode) {\n clearTimeout(this._suggestTimeout);\n if (v.length >= this.options.suggestMinLength) {\n this._suggestTimeout = setTimeout(\n L.bind(function() {\n this._geocode(true);\n }, this),\n this.options.suggestTimeout\n );\n } else {\n this._clearResults();\n }\n }\n }\n }),\n factory: function(options) {\n return new L.Control.Geocoder(options);\n }\n};\n","import L from 'leaflet';\nimport { jsonp } from '../util';\n\nexport default {\n class: L.Class.extend({\n initialize: function(key) {\n this.key = key;\n },\n\n geocode: function(query, cb, context) {\n jsonp(\n 'https://dev.virtualearth.net/REST/v1/Locations',\n {\n query: query,\n key: this.key\n },\n function(data) {\n var results = [];\n if (data.resourceSets.length > 0) {\n for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) {\n var resource = data.resourceSets[0].resources[i],\n bbox = resource.bbox;\n results[i] = {\n name: resource.name,\n bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]),\n center: L.latLng(resource.point.coordinates)\n };\n }\n }\n cb.call(context, results);\n },\n this,\n 'jsonp'\n );\n },\n\n reverse: function(location, scale, cb, context) {\n jsonp(\n '//dev.virtualearth.net/REST/v1/Locations/' + location.lat + ',' + location.lng,\n {\n key: this.key\n },\n function(data) {\n var results = [];\n for (var i = data.resourceSets[0].resources.length - 1; i >= 0; i--) {\n var resource = data.resourceSets[0].resources[i],\n bbox = resource.bbox;\n results[i] = {\n name: resource.name,\n bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]),\n center: L.latLng(resource.point.coordinates)\n };\n }\n cb.call(context, results);\n },\n this,\n 'jsonp'\n );\n }\n }),\n\n factory: function(key) {\n return new L.Control.Geocoder.Bing(key);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n serviceUrl: 'https://www.mapquestapi.com/geocoding/v1'\n },\n\n initialize: function(key, options) {\n // MapQuest seems to provide URI encoded API keys,\n // so to avoid encoding them twice, we decode them here\n this._key = decodeURIComponent(key);\n\n L.Util.setOptions(this, options);\n },\n\n _formatName: function() {\n var r = [],\n i;\n for (i = 0; i < arguments.length; i++) {\n if (arguments[i]) {\n r.push(arguments[i]);\n }\n }\n\n return r.join(', ');\n },\n\n geocode: function(query, cb, context) {\n getJSON(\n this.options.serviceUrl + '/address',\n {\n key: this._key,\n location: query,\n limit: 5,\n outFormat: 'json'\n },\n L.bind(function(data) {\n var results = [],\n loc,\n latLng;\n if (data.results && data.results[0].locations) {\n for (var i = data.results[0].locations.length - 1; i >= 0; i--) {\n loc = data.results[0].locations[i];\n latLng = L.latLng(loc.latLng);\n results[i] = {\n name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1),\n bbox: L.latLngBounds(latLng, latLng),\n center: latLng\n };\n }\n }\n\n cb.call(context, results);\n }, this)\n );\n },\n\n reverse: function(location, scale, cb, context) {\n getJSON(\n this.options.serviceUrl + '/reverse',\n {\n key: this._key,\n location: location.lat + ',' + location.lng,\n outputFormat: 'json'\n },\n L.bind(function(data) {\n var results = [],\n loc,\n latLng;\n if (data.results && data.results[0].locations) {\n for (var i = data.results[0].locations.length - 1; i >= 0; i--) {\n loc = data.results[0].locations[i];\n latLng = L.latLng(loc.latLng);\n results[i] = {\n name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1),\n bbox: L.latLngBounds(latLng, latLng),\n center: latLng\n };\n }\n }\n\n cb.call(context, results);\n }, this)\n );\n }\n }),\n\n factory: function(key, options) {\n return new L.Control.Geocoder.MapQuest(key, options);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n serviceUrl: 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places-v1/',\n geocodingQueryParams: {},\n reverseQueryParams: {}\n },\n\n initialize: function(accessToken, options) {\n L.setOptions(this, options);\n this.options.geocodingQueryParams.access_token = accessToken;\n this.options.reverseQueryParams.access_token = accessToken;\n },\n\n geocode: function(query, cb, context) {\n var params = this.options.geocodingQueryParams;\n if (\n typeof params.proximity !== 'undefined' &&\n params.proximity.hasOwnProperty('lat') &&\n params.proximity.hasOwnProperty('lng')\n ) {\n params.proximity = params.proximity.lng + ',' + params.proximity.lat;\n }\n getJSON(this.options.serviceUrl + encodeURIComponent(query) + '.json', params, function(\n data\n ) {\n var results = [],\n loc,\n latLng,\n latLngBounds;\n if (data.features && data.features.length) {\n for (var i = 0; i <= data.features.length - 1; i++) {\n loc = data.features[i];\n latLng = L.latLng(loc.center.reverse());\n if (loc.hasOwnProperty('bbox')) {\n latLngBounds = L.latLngBounds(\n L.latLng(loc.bbox.slice(0, 2).reverse()),\n L.latLng(loc.bbox.slice(2, 4).reverse())\n );\n } else {\n latLngBounds = L.latLngBounds(latLng, latLng);\n }\n results[i] = {\n name: loc.place_name,\n bbox: latLngBounds,\n center: latLng\n };\n }\n }\n\n cb.call(context, results);\n });\n },\n\n suggest: function(query, cb, context) {\n return this.geocode(query, cb, context);\n },\n\n reverse: function(location, scale, cb, context) {\n getJSON(\n this.options.serviceUrl +\n encodeURIComponent(location.lng) +\n ',' +\n encodeURIComponent(location.lat) +\n '.json',\n this.options.reverseQueryParams,\n function(data) {\n var results = [],\n loc,\n latLng,\n latLngBounds;\n if (data.features && data.features.length) {\n for (var i = 0; i <= data.features.length - 1; i++) {\n loc = data.features[i];\n latLng = L.latLng(loc.center.reverse());\n if (loc.hasOwnProperty('bbox')) {\n latLngBounds = L.latLngBounds(\n L.latLng(loc.bbox.slice(0, 2).reverse()),\n L.latLng(loc.bbox.slice(2, 4).reverse())\n );\n } else {\n latLngBounds = L.latLngBounds(latLng, latLng);\n }\n results[i] = {\n name: loc.place_name,\n bbox: latLngBounds,\n center: latLng\n };\n }\n }\n\n cb.call(context, results);\n }\n );\n }\n }),\n\n factory: function(accessToken, options) {\n return new L.Control.Geocoder.Mapbox(accessToken, options);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n serviceUrl: 'https://api.what3words.com/v2/'\n },\n\n initialize: function(accessToken) {\n this._accessToken = accessToken;\n },\n\n geocode: function(query, cb, context) {\n //get three words and make a dot based string\n getJSON(\n this.options.serviceUrl + 'forward',\n {\n key: this._accessToken,\n addr: query.split(/\\s+/).join('.')\n },\n function(data) {\n var results = [],\n latLng,\n latLngBounds;\n if (data.hasOwnProperty('geometry')) {\n latLng = L.latLng(data.geometry['lat'], data.geometry['lng']);\n latLngBounds = L.latLngBounds(latLng, latLng);\n results[0] = {\n name: data.words,\n bbox: latLngBounds,\n center: latLng\n };\n }\n\n cb.call(context, results);\n }\n );\n },\n\n suggest: function(query, cb, context) {\n return this.geocode(query, cb, context);\n },\n\n reverse: function(location, scale, cb, context) {\n getJSON(\n this.options.serviceUrl + 'reverse',\n {\n key: this._accessToken,\n coords: [location.lat, location.lng].join(',')\n },\n function(data) {\n var results = [],\n latLng,\n latLngBounds;\n if (data.status.status == 200) {\n latLng = L.latLng(data.geometry['lat'], data.geometry['lng']);\n latLngBounds = L.latLngBounds(latLng, latLng);\n results[0] = {\n name: data.words,\n bbox: latLngBounds,\n center: latLng\n };\n }\n cb.call(context, results);\n }\n );\n }\n }),\n\n factory: function(accessToken) {\n return new L.Control.Geocoder.What3Words(accessToken);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json',\n geocodingQueryParams: {},\n reverseQueryParams: {}\n },\n\n initialize: function(key, options) {\n this._key = key;\n L.setOptions(this, options);\n // Backwards compatibility\n this.options.serviceUrl = this.options.service_url || this.options.serviceUrl;\n },\n\n geocode: function(query, cb, context) {\n var params = {\n address: query\n };\n\n if (this._key && this._key.length) {\n params.key = this._key;\n }\n\n params = L.Util.extend(params, this.options.geocodingQueryParams);\n\n getJSON(this.options.serviceUrl, params, function(data) {\n var results = [],\n loc,\n latLng,\n latLngBounds;\n if (data.results && data.results.length) {\n for (var i = 0; i <= data.results.length - 1; i++) {\n loc = data.results[i];\n latLng = L.latLng(loc.geometry.location);\n latLngBounds = L.latLngBounds(\n L.latLng(loc.geometry.viewport.northeast),\n L.latLng(loc.geometry.viewport.southwest)\n );\n results[i] = {\n name: loc.formatted_address,\n bbox: latLngBounds,\n center: latLng,\n properties: loc.address_components\n };\n }\n }\n\n cb.call(context, results);\n });\n },\n\n reverse: function(location, scale, cb, context) {\n var params = {\n latlng: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng)\n };\n params = L.Util.extend(params, this.options.reverseQueryParams);\n if (this._key && this._key.length) {\n params.key = this._key;\n }\n\n getJSON(this.options.serviceUrl, params, function(data) {\n var results = [],\n loc,\n latLng,\n latLngBounds;\n if (data.results && data.results.length) {\n for (var i = 0; i <= data.results.length - 1; i++) {\n loc = data.results[i];\n latLng = L.latLng(loc.geometry.location);\n latLngBounds = L.latLngBounds(\n L.latLng(loc.geometry.viewport.northeast),\n L.latLng(loc.geometry.viewport.southwest)\n );\n results[i] = {\n name: loc.formatted_address,\n bbox: latLngBounds,\n center: latLng,\n properties: loc.address_components\n };\n }\n }\n\n cb.call(context, results);\n });\n }\n }),\n\n factory: function(key, options) {\n return new L.Control.Geocoder.Google(key, options);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n serviceUrl: 'https://photon.komoot.de/api/',\n reverseUrl: 'https://photon.komoot.de/reverse/',\n nameProperties: ['name', 'street', 'suburb', 'hamlet', 'town', 'city', 'state', 'country']\n },\n\n initialize: function(options) {\n L.setOptions(this, options);\n },\n\n geocode: function(query, cb, context) {\n var params = L.extend(\n {\n q: query\n },\n this.options.geocodingQueryParams\n );\n\n getJSON(\n this.options.serviceUrl,\n params,\n L.bind(function(data) {\n cb.call(context, this._decodeFeatures(data));\n }, this)\n );\n },\n\n suggest: function(query, cb, context) {\n return this.geocode(query, cb, context);\n },\n\n reverse: function(latLng, scale, cb, context) {\n var params = L.extend(\n {\n lat: latLng.lat,\n lon: latLng.lng\n },\n this.options.reverseQueryParams\n );\n\n getJSON(\n this.options.reverseUrl,\n params,\n L.bind(function(data) {\n cb.call(context, this._decodeFeatures(data));\n }, this)\n );\n },\n\n _decodeFeatures: function(data) {\n var results = [],\n i,\n f,\n c,\n latLng,\n extent,\n bbox;\n\n if (data && data.features) {\n for (i = 0; i < data.features.length; i++) {\n f = data.features[i];\n c = f.geometry.coordinates;\n latLng = L.latLng(c[1], c[0]);\n extent = f.properties.extent;\n\n if (extent) {\n bbox = L.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]);\n } else {\n bbox = L.latLngBounds(latLng, latLng);\n }\n\n results.push({\n name: this._deocodeFeatureName(f),\n html: this.options.htmlTemplate ? this.options.htmlTemplate(f) : undefined,\n center: latLng,\n bbox: bbox,\n properties: f.properties\n });\n }\n }\n\n return results;\n },\n\n _deocodeFeatureName: function(f) {\n var j, name;\n for (j = 0; !name && j < this.options.nameProperties.length; j++) {\n name = f.properties[this.options.nameProperties[j]];\n }\n\n return name;\n }\n }),\n\n factory: function(options) {\n return new L.Control.Geocoder.Photon(options);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n serviceUrl: 'https://search.mapzen.com/v1',\n geocodingQueryParams: {},\n reverseQueryParams: {}\n },\n\n initialize: function(apiKey, options) {\n L.Util.setOptions(this, options);\n this._apiKey = apiKey;\n this._lastSuggest = 0;\n },\n\n geocode: function(query, cb, context) {\n var _this = this;\n getJSON(\n this.options.serviceUrl + '/search',\n L.extend(\n {\n api_key: this._apiKey,\n text: query\n },\n this.options.geocodingQueryParams\n ),\n function(data) {\n cb.call(context, _this._parseResults(data, 'bbox'));\n }\n );\n },\n\n suggest: function(query, cb, context) {\n var _this = this;\n getJSON(\n this.options.serviceUrl + '/autocomplete',\n L.extend(\n {\n api_key: this._apiKey,\n text: query\n },\n this.options.geocodingQueryParams\n ),\n L.bind(function(data) {\n if (data.geocoding.timestamp > this._lastSuggest) {\n this._lastSuggest = data.geocoding.timestamp;\n cb.call(context, _this._parseResults(data, 'bbox'));\n }\n }, this)\n );\n },\n\n reverse: function(location, scale, cb, context) {\n var _this = this;\n getJSON(\n this.options.serviceUrl + '/reverse',\n L.extend(\n {\n api_key: this._apiKey,\n 'point.lat': location.lat,\n 'point.lon': location.lng\n },\n this.options.reverseQueryParams\n ),\n function(data) {\n cb.call(context, _this._parseResults(data, 'bounds'));\n }\n );\n },\n\n _parseResults: function(data, bboxname) {\n var results = [];\n L.geoJson(data, {\n pointToLayer: function(feature, latlng) {\n return L.circleMarker(latlng);\n },\n onEachFeature: function(feature, layer) {\n var result = {},\n bbox,\n center;\n\n if (layer.getBounds) {\n bbox = layer.getBounds();\n center = bbox.getCenter();\n } else {\n center = layer.getLatLng();\n bbox = L.latLngBounds(center, center);\n }\n\n result.name = layer.feature.properties.label;\n result.center = center;\n result[bboxname] = bbox;\n result.properties = layer.feature.properties;\n results.push(result);\n }\n });\n return results;\n }\n }),\n\n factory: function(apiKey, options) {\n return new L.Control.Geocoder.Mapzen(apiKey, options);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n service_url: 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer'\n },\n\n initialize: function(accessToken, options) {\n L.setOptions(this, options);\n this._accessToken = accessToken;\n },\n\n geocode: function(query, cb, context) {\n var params = {\n SingleLine: query,\n outFields: 'Addr_Type',\n forStorage: false,\n maxLocations: 10,\n f: 'json'\n };\n\n if (this._key && this._key.length) {\n params.token = this._key;\n }\n\n getJSON(this.options.service_url + '/findAddressCandidates', params, function(data) {\n var results = [],\n loc,\n latLng,\n latLngBounds;\n\n if (data.candidates && data.candidates.length) {\n for (var i = 0; i <= data.candidates.length - 1; i++) {\n loc = data.candidates[i];\n latLng = L.latLng(loc.location.y, loc.location.x);\n latLngBounds = L.latLngBounds(\n L.latLng(loc.extent.ymax, loc.extent.xmax),\n L.latLng(loc.extent.ymin, loc.extent.xmin)\n );\n results[i] = {\n name: loc.address,\n bbox: latLngBounds,\n center: latLng\n };\n }\n }\n\n cb.call(context, results);\n });\n },\n\n suggest: function(query, cb, context) {\n return this.geocode(query, cb, context);\n },\n\n reverse: function(location, scale, cb, context) {\n var params = {\n location: encodeURIComponent(location.lng) + ',' + encodeURIComponent(location.lat),\n distance: 100,\n f: 'json'\n };\n\n getJSON(this.options.service_url + '/reverseGeocode', params, function(data) {\n var result = [],\n loc;\n\n if (data && !data.error) {\n loc = L.latLng(data.location.y, data.location.x);\n result.push({\n name: data.address.Match_addr,\n center: loc,\n bounds: L.latLngBounds(loc, loc)\n });\n }\n\n cb.call(context, result);\n });\n }\n }),\n\n factory: function(accessToken, options) {\n return new L.Control.Geocoder.ArcGis(accessToken, options);\n }\n};\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport default {\n class: L.Class.extend({\n options: {\n geocodeUrl: 'http://geocoder.api.here.com/6.2/geocode.json',\n reverseGeocodeUrl: 'http://reverse.geocoder.api.here.com/6.2/reversegeocode.json',\n app_id: '',\n app_code: '',\n geocodingQueryParams: {},\n reverseQueryParams: {}\n },\n\n initialize: function(options) {\n L.setOptions(this, options);\n },\n\n geocode: function(query, cb, context) {\n var params = {\n searchtext: query,\n gen: 9,\n app_id: this.options.app_id,\n app_code: this.options.app_code,\n jsonattributes: 1\n };\n params = L.Util.extend(params, this.options.geocodingQueryParams);\n this.getJSON(this.options.geocodeUrl, params, cb, context);\n },\n\n reverse: function(location, scale, cb, context) {\n var params = {\n prox: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng),\n mode: 'retrieveAddresses',\n app_id: this.options.app_id,\n app_code: this.options.app_code,\n gen: 9,\n jsonattributes: 1\n };\n params = L.Util.extend(params, this.options.reverseQueryParams);\n this.getJSON(this.options.reverseGeocodeUrl, params, cb, context);\n },\n\n getJSON: function(url, params, cb, context) {\n getJSON(url, params, function(data) {\n var results = [],\n loc,\n latLng,\n latLngBounds;\n if (data.response.view && data.response.view.length) {\n for (var i = 0; i <= data.response.view[0].result.length - 1; i++) {\n loc = data.response.view[0].result[i].location;\n latLng = L.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude);\n latLngBounds = L.latLngBounds(\n L.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude),\n L.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)\n );\n results[i] = {\n name: loc.address.label,\n bbox: latLngBounds,\n center: latLng\n };\n }\n }\n cb.call(context, results);\n });\n }\n }),\n\n factory: function(options) {\n return new L.Control.Geocoder.HERE(options);\n }\n};\n","import L from 'leaflet';\nimport Control from './control';\nimport Nominatim from './geocoders/nominatim';\nimport Bing from './geocoders/bing';\nimport MapQuest from './geocoders/mapquest';\nimport Mapbox from './geocoders/mapbox';\nimport What3Words from './geocoders/what3words';\nimport Google from './geocoders/google';\nimport Photon from './geocoders/photon';\nimport Mapzen from './geocoders/mapzen';\nimport ArcGis from './geocoders/arcgis';\nimport HERE from './geocoders/here';\n\nvar Geocoder = L.Util.extend(Control.class, {\n Nominatim: Nominatim.class,\n nominatim: Nominatim.factory,\n Bing: Bing.class,\n bing: Bing.factory,\n MapQuest: MapQuest.class,\n mapQuest: MapQuest.factory,\n Mapbox: Mapbox.class,\n mapbox: Mapbox.factory,\n What3Words: What3Words.class,\n what3words: What3Words.factory,\n Google: Google.class,\n google: Google.factory,\n Photon: Photon.class,\n photon: Photon.factory,\n Mapzen: Mapzen.class,\n mapzen: Mapzen.factory,\n ArcGis: ArcGis.class,\n arcgis: ArcGis.factory,\n HERE: HERE.class,\n here: HERE.factory\n});\n\nexport default Geocoder;\n\nL.Util.extend(L.Control, {\n Geocoder: Geocoder,\n geocoder: Control.factory\n});\n"],"names":[],"mappings":";;;;;;;AACA,IAAI,cAAc,GAAG,CAAC,CAAC;;;;AAIvB,IAAI,QAAQ,GAAG,WAAW,CAAC;AAC3B,IAAI,QAAQ,GAAG,UAAU,CAAC;AAC1B,IAAI,MAAM,GAAG;EACX,GAAG,EAAE,OAAO;EACZ,GAAG,EAAE,MAAM;EACX,GAAG,EAAE,MAAM;EACX,GAAG,EAAE,QAAQ;EACb,GAAG,EAAE,QAAQ;EACb,GAAG,EAAE,QAAQ;CACd,CA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EACpB,MAAM,EAAE,MAAM,CAAC,OAAO;EACtB,MAAM,EAAE,MAAM,CAAC,KAAK;EACpB,MAAM,EAAE,MAAM,CAAC,OAAO;EACtB,MAAM,EAAE,MAAM,CAAC,KAAK;EACpB,MAAM,EAAE,MAAM,CAAC,OAAO;EACtB,MAAM,EAAE,MAAM,CAAC,KAAK;EACpB,MAAM,EAAE,MAAM,CAAC,OAAO;EACtB,IAAI,EAAE,IAAI,CAAC,KAAK;EAChB,IAAI,EAAE,IAAI,CAAC,OAAO;CACnB,CAAC,CAAC;;AAEH,AAEA,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE;EACvB,QAAQ,EAAE,QAAQ;EAClB,QAAQ,EAAE,OAAO,CAAC,OAAO;CAC1B,CAAC,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/assets/control-geocoder/README.md b/assets/control-geocoder/README.md index 736b082..ca58b2b 100755 --- a/assets/control-geocoder/README.md +++ b/assets/control-geocoder/README.md @@ -9,11 +9,11 @@ While I can't force anyone to do anything, if you happen to disagree with this, Leaflet Control Geocoder [![NPM version](https://img.shields.io/npm/v/leaflet-control-geocoder.svg)](https://www.npmjs.com/package/leaflet-control-geocoder) ![Leaflet 1.0.0 compatible!](https://img.shields.io/badge/Leaflet%201.0.0-%E2%9C%93-1EB300.svg?style=flat) ============================= -A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim). +A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim). The plugin supports many different data providers: -* [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim) +* [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) * [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx) * [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/) * [Mapbox Geocoding](https://www.mapbox.com/developers/api/geocoding/) @@ -31,12 +31,11 @@ See the [Leaflet Control Geocoder Demo](http://perliedman.github.com/leaflet-con # Usage -[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases). Load the CSS and Javascript, located in -the `dist` folder: +[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases), or obtain the latest release via [unpkg.com](https://unpkg.com/): ```HTML - - + + ``` Add the control to a map instance: @@ -85,49 +84,55 @@ This is the geocoder control. It works like any other Leaflet control, and is ad ### Constructor +This plugin supports the standard JavaScript constructor (to be invoked using `new`) as well as the [class factory methods](http://leafletjs.com/reference.html#class-class-factories) known from Leaflet: + ```js -L.Control.Geocoder(options) +new L.Control.Geocoder(options) +// or +L.Control.geocoder(options) ``` ### Options -| Option | Type | Default | Description | -| --------------- | ---------------- | ----------------- | ----------- | -| collapsed | Boolean | true | Collapse control unless hovered/clicked | -| expand | String | "touch" | How to expand a collapsed control: `touch` `click` `hover` | -| position | String | "topright" | Control [position](http://leafletjs.com/reference.html#control-positions) | -| placeholder | String | "Search..." | Placeholder text for text input -| errorMessage | String | "Nothing found." | Message when no result found / geocoding error occurs | -| geocoder | IGeocoder | new L.Control.Geocoder.Nominatim() | Object to perform the actual geocoding queries | -| showResultIcons | Boolean | false | Show icons for geocoding results (if available); supported by Nominatim | +| Option | Type | Default | Description | +| ----------------- | ---------------- | ------------------- | ----------- | +| `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked | +| `expand` | String | `"touch"` | How to expand a collapsed control: `touch` or `click` or `hover` | +| `position` | String | `"topright"` | Control [position](http://leafletjs.com/reference.html#control-positions) | +| `placeholder` | String | `"Search..."` | Placeholder text for text input +| `errorMessage` | String | `"Nothing found."` | Message when no result found / geocoding error occurs | +| `geocoder` | IGeocoder | `new L.Control.Geocoder.Nominatim()` | Object to perform the actual geocoding queries | +| `showResultIcons` | Boolean | `false` | Show icons for geocoding results (if available); supported by Nominatim | ### Methods | Method | Returns | Description | | ------------------------------------- | ------------------- | ----------------- | -| markGeocode( result) | this | Marks a geocoding result on the map | +| `markGeocode( result)` | `this` | Marks a geocoding result on the map | ## L.Control.Geocoder.Nominatim -Uses [Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim) to respond to geocoding queries. This is the default +Uses [Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) to respond to geocoding queries. This is the default geocoding service used by the control, unless otherwise specified in the options. Implements ```IGeocoder```. -Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy). +Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/). ### Constructor ```js -L.Control.Geocoder.Nominatim(options) +new L.Control.Geocoder.Nominatim(options) +// or +L.Control.Geocoder.nominatim(options) ``` ## Options | Option | Type | Default | Description | | --------------- | ---------------- | ----------------- | ----------- | -| serviceUrl | String | "http://nominatim.openstreetmap.org/" | URL of the service | -| geocodingQueryParams | Object | {} | Additional URL parameters (strings) that will be added to geocoding requests; can be used to restrict results to a specific country for example, by providing the [`countrycodes`](http://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim | -| reverseQueryParams | Object | {} | Additional URL parameters (strings) that will be added to reverse geocoding requests | -| htmlTemplate | function | special | A function that takes an GeocodingResult as argument and returns an HTML formatted string that represents the result. Default function breaks up address in parts from most to least specific, in attempt to increase readability compared to Nominatim's naming +| `serviceUrl` | String | `"https://nominatim.openstreetmap.org/"` | URL of the service | +| `geocodingQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to geocoding requests; can be used to restrict results to a specific country for example, by providing the [`countrycodes`](https://wiki.openstreetmap.org/wiki/Nominatim#Parameters) parameter to Nominatim | +| `reverseQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to reverse geocoding requests | +| `htmlTemplate` | function | special | A function that takes an GeocodingResult as argument and returns an HTML formatted string that represents the result. Default function breaks up address in parts from most to least specific, in attempt to increase readability compared to Nominatim's naming ## L.Control.Geocoder.Bing @@ -137,8 +142,10 @@ Note that you need an API key to use this service. ### Constructor -``` -L.Control.Geocoder.Bing( key) +```ts +new L.Control.Geocoder.Bing( key) +// or +L.Control.Geocoder.bing( key) ``` ## IGeocoder @@ -149,8 +156,8 @@ An interface implemented to respond to geocoding queries. | Method | Returns | Description | | ------------------------------------- | ------------------- | ----------------- | -| geocode( query, callback, context) | GeocodingResult[] | Performs a geocoding query and returns the results to the callback in the provided context | -| reverse( location, scale, callback, context) | GeocodingResult[] | Performs a reverse geocoding query and returns the results to the callback in the provided context | +| `geocode( query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query and returns the results to the callback in the provided context | +| `reverse( location, scale, callback, context)` | `GeocodingResult[]` | Performs a reverse geocoding query and returns the results to the callback in the provided context | ## GeocodingResult @@ -158,10 +165,10 @@ An object that represents a result from a geocoding query. ### Properties -| Property | Type | Description | -| ---------- | ---------------- | ------------------------------------- | -| name | String | Name of found location | -| bbox | L.LatLngBounds | The bounds of the location | -| center | L.LatLng | The center coordinate of the location | -| icon | String | URL for icon representing result; optional | -| html | String | (optional) HTML formatted representation of the name | +| Property | Type | Description | +| ------------ | ---------------- | ------------------------------------- | +| `name` | String | Name of found location | +| `bbox` | L.LatLngBounds | The bounds of the location | +| `center` | L.LatLng | The center coordinate of the location | +| `icon` | String | URL for icon representing result; optional | +| `html` | String | (optional) HTML formatted representation of the name | diff --git a/assets/control-geocoder/package.json b/assets/control-geocoder/package.json index a4da1e3..605d863 100644 --- a/assets/control-geocoder/package.json +++ b/assets/control-geocoder/package.json @@ -1,10 +1,18 @@ { "name": "leaflet-control-geocoder", - "version": "1.5.8", + "version": "1.6.0", "description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest, Mapzen, HERE", "main": "dist/Control.Geocoder.js", "scripts": { - "prepare": "sh ./scripts/build.sh", + "prepare": "npm run build", + "build": "npm run build:js && npm run build:css && npm run build:img", + "build:js": "rollup --output.format=iife --name=L.Control.Geocoder --globals=leaflet:L src/index.js --output.file=dist/Control.Geocoder.js --sourcemap", + "build:css": "cpr Control.Geocoder.css dist/ --overwrite", + "build:img": "cpr images/ dist/images/ --overwrite", + "test": "npm run lint", + "lint": "npm run lint:js && npm run lint:css", + "lint:js": "eslint 'src/**'", + "lint:css": "prettier --list-different '*.css'", "publish": "sh ./scripts/publish.sh", "postpublish": "sh ./scripts/postpublish.sh" }, @@ -31,14 +39,12 @@ "bugs": { "url": "https://github.com/perliedman/leaflet-control-geocoder/issues" }, - "browserify-shim": { - "leaflet": "global:L" - }, "dependencies": {}, "devDependencies": { - "browserify": "^11.0.1", - "browserify-shim": "^3.8.10", - "derequire": "^2.0.3", - "es3ify": "^0.1.4" + "cpr": "^3.0.1", + "eslint": "^4.15.0", + "eslint-plugin-prettier": "^2.4.0", + "prettier": "^1.9.2", + "rollup": "^0.53.2" } } diff --git a/module/config/config.php b/module/config/config.php index 3e9ff6e..b581f80 100644 --- a/module/config/config.php +++ b/module/config/config.php @@ -75,7 +75,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array $GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array ( 'name' => 'Leaflet Control Geocoder', - 'version' => '1.5.8', + 'version' => '1.6.0', 'license' => 'BSD-2-Clause', 'homepage' => 'https://github.com/perliedman/leaflet-control-geocoder', 'css' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css',