New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-control-geocoder

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-control-geocoder - npm Package Compare versions

Comparing version 1.8.0 to 1.8.2

4

dist/Control.Geocoder.js
/* @preserve
* Leaflet Control Geocoder 1.8.0
* Leaflet Control Geocoder 1.8.2
* https://github.com/perliedman/leaflet-control-geocoder

@@ -1300,3 +1300,3 @@ *

if (!this.options.geocoder) {
this.options.geocoder = new Nominatim.class();
this.options.geocoder = new Nominatim();
}

@@ -1303,0 +1303,0 @@

/* @preserve
* Leaflet Control Geocoder 1.8.0
* Leaflet Control Geocoder 1.8.2
* https://github.com/perliedman/leaflet-control-geocoder

@@ -9,3 +9,3 @@ *

*/
this.L=this.L||{},this.L.Control=this.L.Control||{},this.L.Control.Geocoder=function(d){"use strict";d=d&&d.hasOwnProperty("default")?d.default:d;var a=0,n=/[&<>"'`]/g,i=/[&<>"'`]/,t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};function r(e){return t[e]}function o(e,t,o,s,n){var i="_l_geocoder_"+a++;t[n||"callback"]=i,window[i]=d.Util.bind(o,s);var r=document.createElement("script");r.type="text/javascript",r.src=e+l(t),r.id=i,document.getElementsByTagName("head")[0].appendChild(r)}function u(e,t,o){var s=new XMLHttpRequest;s.onreadystatechange=function(){4===s.readyState&&(200===s.status||304===s.status?o(s.response):o(""))},s.open("GET",e+l(t),!0),s.responseType="json",s.setRequestHeader("Accept","application/json"),s.send(null)}function s(e,s){return e.replace(/\{ *([\w_]+) *\}/g,function(e,t){var o=s[t];return void 0===o?o="":"function"==typeof o&&(o=o(s)),function(e){return null==e?"":e?(e=""+e,i.test(e)?e.replace(n,r):e):e+""}(o)})}function l(e,t,o){var s=[];for(var n in e){var i=encodeURIComponent(o?n.toUpperCase():n),r=e[n];if(d.Util.isArray(r))for(var a=0;a<r.length;a++)s.push(i+"="+encodeURIComponent(r[a]));else s.push(i+"="+encodeURIComponent(r))}return(t&&-1!==t.indexOf("?")?"&":"?")+s.join("&")}var c=d.Class.extend({options:{service_url:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"},initialize:function(e,t){d.setOptions(this,t),this._accessToken=e},geocode:function(e,r,a){var t={SingleLine:e,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"};this._key&&this._key.length&&(t.token=this._key),u(this.options.service_url+"/findAddressCandidates",d.extend(t,this.options.geocodingQueryParams),function(e){var t,o,s,n=[];if(e.candidates&&e.candidates.length)for(var i=0;i<=e.candidates.length-1;i++)t=e.candidates[i],o=d.latLng(t.location.y,t.location.x),s=d.latLngBounds(d.latLng(t.extent.ymax,t.extent.xmax),d.latLng(t.extent.ymin,t.extent.xmin)),n[i]={name:t.address,bbox:s,center:o};r.call(a,n)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,s,n){var o={location:encodeURIComponent(e.lng)+","+encodeURIComponent(e.lat),distance:100,f:"json"};u(this.options.service_url+"/reverseGeocode",o,function(e){var t,o=[];e&&!e.error&&(t=d.latLng(e.location.y,e.location.x),o.push({name:e.address.Match_addr,center:t,bounds:d.latLngBounds(t,t)})),s.call(n,o)})}});var p=d.Class.extend({initialize:function(e){this.key=e},geocode:function(e,i,r){o("https://dev.virtualearth.net/REST/v1/Locations",{query:e,key:this.key},function(e){var t=[];if(0<e.resourceSets.length)for(var o=e.resourceSets[0].resources.length-1;0<=o;o--){var s=e.resourceSets[0].resources[o],n=s.bbox;t[o]={name:s.name,bbox:d.latLngBounds([n[0],n[1]],[n[2],n[3]]),center:d.latLng(s.point.coordinates)}}i.call(r,t)},this,"jsonp")},reverse:function(e,t,i,r){o("//dev.virtualearth.net/REST/v1/Locations/"+e.lat+","+e.lng,{key:this.key},function(e){for(var t=[],o=e.resourceSets[0].resources.length-1;0<=o;o--){var s=e.resourceSets[0].resources[o],n=s.bbox;t[o]={name:s.name,bbox:d.latLngBounds([n[0],n[1]],[n[2],n[3]]),center:d.latLng(s.point.coordinates)}}i.call(r,t)},this,"jsonp")}});var h=d.Class.extend({options:{serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e,t){this._key=e,d.setOptions(this,t),this.options.serviceUrl=this.options.service_url||this.options.serviceUrl},geocode:function(e,r,a){var t={address:e};this._key&&this._key.length&&(t.key=this._key),t=d.Util.extend(t,this.options.geocodingQueryParams),u(this.options.serviceUrl,t,function(e){var t,o,s,n=[];if(e.results&&e.results.length)for(var i=0;i<=e.results.length-1;i++)t=e.results[i],o=d.latLng(t.geometry.location),s=d.latLngBounds(d.latLng(t.geometry.viewport.northeast),d.latLng(t.geometry.viewport.southwest)),n[i]={name:t.formatted_address,bbox:s,center:o,properties:t.address_components};r.call(a,n)})},reverse:function(e,t,r,a){var o={latlng:encodeURIComponent(e.lat)+","+encodeURIComponent(e.lng)};o=d.Util.extend(o,this.options.reverseQueryParams),this._key&&this._key.length&&(o.key=this._key),u(this.options.serviceUrl,o,function(e){var t,o,s,n=[];if(e.results&&e.results.length)for(var i=0;i<=e.results.length-1;i++)t=e.results[i],o=d.latLng(t.geometry.location),s=d.latLngBounds(d.latLng(t.geometry.viewport.northeast),d.latLng(t.geometry.viewport.southwest)),n[i]={name:t.formatted_address,bbox:s,center:o,properties:t.address_components};r.call(a,n)})}});var g=d.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:"<insert your app_id here>",app_code:"<insert your app_code here>",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e){d.setOptions(this,e)},geocode:function(e,t,o){var s={searchtext:e,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1};s=d.Util.extend(s,this.options.geocodingQueryParams),this.getJSON(this.options.geocodeUrl,s,t,o)},reverse:function(e,t,o,s){var n={prox:encodeURIComponent(e.lat)+","+encodeURIComponent(e.lng),mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1};n=d.Util.extend(n,this.options.reverseQueryParams),this.getJSON(this.options.reverseGeocodeUrl,n,o,s)},getJSON:function(e,t,r,a){u(e,t,function(e){var t,o,s,n=[];if(e.response.view&&e.response.view.length)for(var i=0;i<=e.response.view[0].result.length-1;i++)t=e.response.view[0].result[i].location,o=d.latLng(t.displayPosition.latitude,t.displayPosition.longitude),s=d.latLngBounds(d.latLng(t.mapView.topLeft.latitude,t.mapView.topLeft.longitude),d.latLng(t.mapView.bottomRight.latitude,t.mapView.bottomRight.longitude)),n[i]={name:t.address.label,bbox:s,center:o};r.call(a,n)})}});var m=d.Class.extend({options:{next:void 0,sizeInMeters:1e4},initialize:function(e){d.Util.setOptions(this,e)},geocode:function(e,t,o){var s,n;if((s=e.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?n=d.latLng((/N/i.test(s[1])?1:-1)*parseFloat(s[2]),(/E/i.test(s[3])?1:-1)*parseFloat(s[4])):(s=e.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?n=d.latLng((/N/i.test(s[2])?1:-1)*parseFloat(s[1]),(/E/i.test(s[4])?1:-1)*parseFloat(s[3])):(s=e.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?n=d.latLng((/N/i.test(s[1])?1:-1)*(parseFloat(s[2])+parseFloat(s[3]/60)),(/E/i.test(s[4])?1:-1)*(parseFloat(s[5])+parseFloat(s[6]/60))):(s=e.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?n=d.latLng((/N/i.test(s[3])?1:-1)*(parseFloat(s[1])+parseFloat(s[2]/60)),(/E/i.test(s[6])?1:-1)*(parseFloat(s[4])+parseFloat(s[5]/60))):(s=e.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/))?n=d.latLng((/N/i.test(s[1])?1:-1)*(parseFloat(s[2])+parseFloat(s[3]/60+parseFloat(s[4]/3600))),(/E/i.test(s[5])?1:-1)*(parseFloat(s[6])+parseFloat(s[7]/60)+parseFloat(s[8]/3600))):(s=e.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/))?n=d.latLng((/N/i.test(s[4])?1:-1)*(parseFloat(s[1])+parseFloat(s[2]/60+parseFloat(s[3]/3600))),(/E/i.test(s[8])?1:-1)*(parseFloat(s[5])+parseFloat(s[6]/60)+parseFloat(s[7]/3600))):(s=e.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))&&(n=d.latLng(parseFloat(s[1]),parseFloat(s[2]))),n){var i=[{name:e,center:n,bbox:n.toBounds(this.options.sizeInMeters)}];t.call(o,i)}else this.options.next&&this.options.next.geocode(e,t,o)}});var v=d.Class.extend({options:{serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e,t){d.setOptions(this,t),this.options.geocodingQueryParams.access_token=e,this.options.reverseQueryParams.access_token=e},geocode:function(e,l,c){var t=this.options.geocodingQueryParams;void 0!==t.proximity&&t.proximity.hasOwnProperty("lat")&&t.proximity.hasOwnProperty("lng")&&(t.proximity=t.proximity.lng+","+t.proximity.lat),u(this.options.serviceUrl+encodeURIComponent(e)+".json",t,function(e){var t,o,s,n=[];if(e.features&&e.features.length)for(var i=0;i<=e.features.length-1;i++){t=e.features[i],o=d.latLng(t.center.reverse()),s=t.hasOwnProperty("bbox")?d.latLngBounds(d.latLng(t.bbox.slice(0,2).reverse()),d.latLng(t.bbox.slice(2,4).reverse())):d.latLngBounds(o,o);for(var r={text:t.text,address:t.address},a=0;a<t.context.length;a++){r[t.context[a].id.split(".")[0]]=t.context[a].text}n[i]={name:t.place_name,bbox:s,center:o,properties:r}}l.call(c,n)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,r,a){u(this.options.serviceUrl+encodeURIComponent(e.lng)+","+encodeURIComponent(e.lat)+".json",this.options.reverseQueryParams,function(e){var t,o,s,n=[];if(e.features&&e.features.length)for(var i=0;i<=e.features.length-1;i++)t=e.features[i],o=d.latLng(t.center.reverse()),s=t.hasOwnProperty("bbox")?d.latLngBounds(d.latLng(t.bbox.slice(0,2).reverse()),d.latLng(t.bbox.slice(2,4).reverse())):d.latLngBounds(o,o),n[i]={name:t.place_name,bbox:s,center:o};r.call(a,n)})}});var f=d.Class.extend({options:{serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},initialize:function(e,t){this._key=decodeURIComponent(e),d.Util.setOptions(this,t)},_formatName:function(){var e,t=[];for(e=0;e<arguments.length;e++)arguments[e]&&t.push(arguments[e]);return t.join(", ")},geocode:function(e,i,r){u(this.options.serviceUrl+"/address",{key:this._key,location:e,limit:5,outFormat:"json"},d.bind(function(e){var t,o,s=[];if(e.results&&e.results[0].locations)for(var n=e.results[0].locations.length-1;0<=n;n--)t=e.results[0].locations[n],o=d.latLng(t.latLng),s[n]={name:this._formatName(t.street,t.adminArea4,t.adminArea3,t.adminArea1),bbox:d.latLngBounds(o,o),center:o};i.call(r,s)},this))},reverse:function(e,t,i,r){u(this.options.serviceUrl+"/reverse",{key:this._key,location:e.lat+","+e.lng,outputFormat:"json"},d.bind(function(e){var t,o,s=[];if(e.results&&e.results[0].locations)for(var n=e.results[0].locations.length-1;0<=n;n--)t=e.results[0].locations[n],o=d.latLng(t.latLng),s[n]={name:this._formatName(t.street,t.adminArea4,t.adminArea3,t.adminArea1),bbox:d.latLngBounds(o,o),center:o};i.call(r,s)},this))}});var _=d.Class.extend({options:{userId:"<insert your userId here>",apiKey:"<insert your apiKey here>",serviceUrl:"https://neutrinoapi.com/"},initialize:function(e){d.Util.setOptions(this,e)},geocode:function(e,n,i){u(this.options.serviceUrl+"geocode-address",{apiKey:this.options.apiKey,userId:this.options.userId,address:e.split(/\s+/).join(".")},function(e){var t,o,s=[];e.hasOwnProperty("locations")&&(e.geometry=e.locations[0],t=d.latLng(e.geometry.latitude,e.geometry.longitude),o=d.latLngBounds(t,t),s[0]={name:e.geometry.address,bbox:o,center:t}),n.call(i,s)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(n,e,i,r){u(this.options.serviceUrl+"geocode-reverse",{apiKey:this.options.apiKey,userId:this.options.userId,latitude:n.lat,longitude:n.lng},function(e){var t,o,s=[];200==e.status.status&&e.found&&(t=d.latLng(n.lat,n.lng),o=d.latLngBounds(t,t),s[0]={name:e.address,bbox:o,center:t}),i.call(r,s)})}});var b=d.Class.extend({options:{serviceUrl:"https://nominatim.openstreetmap.org/",geocodingQueryParams:{},reverseQueryParams:{},htmlTemplate:function(e){var t=e.address,o=[];return(t.road||t.building)&&o.push("{building} {road} {house_number}"),(t.city||t.town||t.village||t.hamlet)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(t.state||t.country)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),s(o.join("<br/>"),t)}},initialize:function(e){d.Util.setOptions(this,e)},geocode:function(e,i,r){u(this.options.serviceUrl+"search",d.extend({q:e,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),d.bind(function(e){for(var t=[],o=e.length-1;0<=o;o--){for(var s=e[o].boundingbox,n=0;n<4;n++)s[n]=parseFloat(s[n]);t[o]={icon:e[o].icon,name:e[o].display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(e[o]):void 0,bbox:d.latLngBounds([s[0],s[2]],[s[1],s[3]]),center:d.latLng(e[o].lat,e[o].lon),properties:e[o]}}i.call(r,t)},this))},reverse:function(e,t,s,n){u(this.options.serviceUrl+"reverse",d.extend({lat:e.lat,lon:e.lng,zoom:Math.round(Math.log(t/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),d.bind(function(e){var t,o=[];e&&e.lat&&e.lon&&(t=d.latLng(e.lat,e.lon),o.push({name:e.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(e):void 0,center:t,bounds:d.latLngBounds(t,t),properties:e})),s.call(n,o)},this))}});var y=d.Class.extend({options:{OpenLocationCode:void 0,codeLength:void 0},initialize:function(e){d.setOptions(this,e)},geocode:function(e,t,o){try{var s=this.options.OpenLocationCode.decode(e),n={name:e,center:d.latLng(s.latitudeCenter,s.longitudeCenter),bbox:d.latLngBounds(d.latLng(s.latitudeLo,s.longitudeLo),d.latLng(s.latitudeHi,s.longitudeHi))};t.call(o,[n])}catch(e){console.warn(e),t.call(o,[])}},reverse:function(e,t,o,s){try{var n={name:this.options.OpenLocationCode.encode(e.lat,e.lng,this.options.codeLength),center:d.latLng(e.lat,e.lng),bbox:d.latLngBounds(d.latLng(e.lat,e.lng),d.latLng(e.lat,e.lng))};o.call(s,[n])}catch(e){console.warn(e),o.call(s,[])}}});var L=d.Class.extend({options:{serviceUrl:"https://api.geocode.earth/v1",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e,t){d.Util.setOptions(this,t),this._apiKey=e,this._lastSuggest=0},geocode:function(e,t,o){var s=this;u(this.options.serviceUrl+"/search",d.extend({api_key:this._apiKey,text:e},this.options.geocodingQueryParams),function(e){t.call(o,s._parseResults(e,"bbox"))})},suggest:function(e,t,o){var s=this;u(this.options.serviceUrl+"/autocomplete",d.extend({api_key:this._apiKey,text:e},this.options.geocodingQueryParams),d.bind(function(e){e.geocoding.timestamp>this._lastSuggest&&(this._lastSuggest=e.geocoding.timestamp,t.call(o,s._parseResults(e,"bbox")))},this))},reverse:function(e,t,o,s){var n=this;u(this.options.serviceUrl+"/reverse",d.extend({api_key:this._apiKey,"point.lat":e.lat,"point.lon":e.lng},this.options.reverseQueryParams),function(e){o.call(s,n._parseResults(e,"bounds"))})},_parseResults:function(e,i){var r=[];return d.geoJson(e,{pointToLayer:function(e,t){return d.circleMarker(t)},onEachFeature:function(e,t){var o,s,n={};t.getBounds?s=(o=t.getBounds()).getCenter():o=t.feature.bbox?(s=t.getLatLng(),d.latLngBounds(d.GeoJSON.coordsToLatLng(t.feature.bbox.slice(0,2)),d.GeoJSON.coordsToLatLng(t.feature.bbox.slice(2,4)))):(s=t.getLatLng(),d.latLngBounds(s,s)),n.name=t.feature.properties.label,n.center=s,n[i]=o,n.properties=t.feature.properties,r.push(n)}}),r}});function e(e,t){return new L(e,t)}var x=L,U=e,C=L,w=e,k=C.extend({options:{serviceUrl:"https://api.openrouteservice.org/geocode"}});var D=d.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(e){d.setOptions(this,e)},geocode:function(e,t,o){var s=d.extend({q:e},this.options.geocodingQueryParams);u(this.options.serviceUrl,s,d.bind(function(e){t.call(o,this._decodeFeatures(e))},this))},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,o,s){var n=d.extend({lat:e.lat,lon:e.lng},this.options.reverseQueryParams);u(this.options.reverseUrl,n,d.bind(function(e){o.call(s,this._decodeFeatures(e))},this))},_decodeFeatures:function(e){var t,o,s,n,i,r,a=[];if(e&&e.features)for(t=0;t<e.features.length;t++)s=(o=e.features[t]).geometry.coordinates,n=d.latLng(s[1],s[0]),r=(i=o.properties.extent)?d.latLngBounds([i[1],i[0]],[i[3],i[2]]):d.latLngBounds(n,n),a.push({name:this._decodeFeatureName(o),html:this.options.htmlTemplate?this.options.htmlTemplate(o):void 0,center:n,bbox:r,properties:o.properties});return a},_decodeFeatureName:function(t){return(this.options.nameProperties||[]).map(function(e){return t.properties[e]}).filter(function(e){return!!e}).join(", ")}});var E=d.Class.extend({options:{serviceUrl:"https://api.what3words.com/v2/"},initialize:function(e){this._accessToken=e},geocode:function(e,n,i){u(this.options.serviceUrl+"forward",{key:this._accessToken,addr:e.split(/\s+/).join(".")},function(e){var t,o,s=[];e.hasOwnProperty("geometry")&&(t=d.latLng(e.geometry.lat,e.geometry.lng),o=d.latLngBounds(t,t),s[0]={name:e.words,bbox:o,center:t}),n.call(i,s)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,n,i){u(this.options.serviceUrl+"reverse",{key:this._accessToken,coords:[e.lat,e.lng].join(",")},function(e){var t,o,s=[];200==e.status.status&&(t=d.latLng(e.geometry.lat,e.geometry.lng),o=d.latLngBounds(t,t),s[0]={name:e.words,bbox:o,center:t}),n.call(i,s)})}});var P=Object.freeze({ArcGis:c,arcgis:function(e,t){return new c(e,t)},Bing:p,bing:function(e){return new p(e)},Google:h,google:function(e,t){return new h(e,t)},HERE:g,here:function(e){return new g(e)},LatLng:m,latLng:function(e){return new m(e)},Mapbox:v,mapbox:function(e,t){return new v(e,t)},MapQuest:f,mapQuest:function(e,t){return new f(e,t)},Neutrino:_,neutrino:function(e){return new _(e)},Nominatim:b,nominatim:function(e){return new b(e)},OpenLocationCode:y,openLocationCode:function(e){return new y(e)},Pelias:L,pelias:e,GeocodeEarth:x,geocodeEarth:U,Mapzen:C,mapzen:w,Openrouteservice:k,openrouteservice:function(e,t){return new k(e,t)},Photon:D,photon:function(e){return new D(e)},What3Words:E,what3words:function(e){return new E(e)}}),T=d.Control.extend({options:{showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},includes:d.Evented.prototype||d.Mixin.Events,initialize:function(e){d.Util.setOptions(this,e),this.options.geocoder||(this.options.geocoder=new b.class),this._requestCount=0},addThrobberClass:function(){d.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},removeThrobberClass:function(){d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},onAdd:function(e){var t,o="leaflet-control-geocoder",s=d.DomUtil.create("div",o+" leaflet-bar"),n=d.DomUtil.create("button",o+"-icon",s),i=this._form=d.DomUtil.create("div",o+"-form",s);return this._map=e,this._container=s,n.innerHTML="&nbsp;",n.type="button",(t=this._input=d.DomUtil.create("input","",i)).type="text",t.placeholder=this.options.placeholder,d.DomEvent.disableClickPropagation(t),this._errorElement=d.DomUtil.create("div",o+"-form-no-error",s),this._errorElement.innerHTML=this.options.errorMessage,this._alts=d.DomUtil.create("ul",o+"-alternatives leaflet-control-geocoder-alternatives-minimized",s),d.DomEvent.disableClickPropagation(this._alts),d.DomEvent.addListener(t,"keydown",this._keydown,this),this.options.geocoder.suggest&&d.DomEvent.addListener(t,"input",this._change,this),d.DomEvent.addListener(t,"blur",function(){this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1},this),this.options.collapsed?"click"===this.options.expand?d.DomEvent.addListener(s,"click",function(e){0===e.button&&2!==e.detail&&this._toggle()},this):d.Browser.touch&&"touch"===this.options.expand?d.DomEvent.addListener(s,"touchstart mousedown",function(e){this._toggle(),e.preventDefault(),e.stopPropagation()},this):(d.DomEvent.addListener(s,"mouseover",this._expand,this),d.DomEvent.addListener(s,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),d.Browser.touch?d.DomEvent.addListener(s,"touchstart",function(){this._geocode()},this):d.DomEvent.addListener(s,"click",function(){this._geocode()},this)),this.options.defaultMarkGeocode&&this.on("markgeocode",this.markGeocode,this),this.on("startgeocode",this.addThrobberClass,this),this.on("finishgeocode",this.removeThrobberClass,this),this.on("startsuggest",this.addThrobberClass,this),this.on("finishsuggest",this.removeThrobberClass,this),d.DomEvent.disableClickPropagation(s),s},_geocodeResult:function(e,t){if(t||1!==e.length)if(0<e.length){this._alts.innerHTML="",this._results=e,d.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),d.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var o=0;o<e.length;o++)this._alts.appendChild(this._createAlt(e[o],o))}else d.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),d.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error");else this._geocodeResultSelected(e[0])},markGeocode:function(e){return e=e.geocode||e,this._map.fitBounds(e.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new d.Marker(e.center).bindPopup(e.html||e.name).addTo(this._map).openPopup(),this},_geocode:function(t){var e=this._input.value;if(t||!(e.length<this.options.queryMinLength)){var o=++this._requestCount,s=t?"suggest":"geocode",n={input:e};this._lastGeocode=e,t||this._clearResults(),this.fire("start"+s,n),this.options.geocoder[s](e,function(e){o===this._requestCount&&(n.results=e,this.fire("finish"+s,n),this._geocodeResult(e,t))},this)}},_geocodeResultSelected:function(e){this.fire("markgeocode",{geocode:e})},_toggle:function(){d.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},_expand:function(){d.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},_collapse:function(){d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),d.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),d.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},_clearResults:function(){d.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,d.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},_createAlt:function(t,e){var o=d.DomUtil.create("li",""),s=d.DomUtil.create("a","",o),n=this.options.showResultIcons&&t.icon?d.DomUtil.create("img","",s):null,i=t.html?void 0:document.createTextNode(t.name);return n&&(n.src=t.icon),o.setAttribute("data-result-index",e),t.html?s.innerHTML=s.innerHTML+t.html:s.appendChild(i),d.DomEvent.addListener(o,"mousedown touchstart",function(e){this._preventBlurCollapse=!0,d.DomEvent.stop(e),this._geocodeResultSelected(t),d.DomEvent.on(o,"click",function(){this.options.collapsed?this._collapse():this._clearResults()},this)},this),o},_keydown:function(e){function t(e){o._selection&&(d.DomUtil.removeClass(o._selection,"leaflet-control-geocoder-selected"),o._selection=o._selection[0<e?"nextSibling":"previousSibling"]),o._selection||(o._selection=o._alts[0<e?"firstChild":"lastChild"]),o._selection&&d.DomUtil.addClass(o._selection,"leaflet-control-geocoder-selected")}var o=this;switch(e.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:t(-1);break;case 40:t(1);break;case 13:if(this._selection){var s=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[s]),this._clearResults()}else this._geocode();break;default:return}d.DomEvent.preventDefault(e)},_change:function(){var e=this._input.value;e!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),e.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(d.bind(function(){this._geocode(!0)},this),this.options.suggestTimeout):this._clearResults())}});return d.Util.extend(T,P),d.Util.extend(d.Control,{Geocoder:T,geocoder:function(e){return new T(e)}}),T}(L);
this.L=this.L||{},this.L.Control=this.L.Control||{},this.L.Control.Geocoder=function(d){"use strict";d=d&&d.hasOwnProperty("default")?d.default:d;var a=0,n=/[&<>"'`]/g,i=/[&<>"'`]/,t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};function r(e){return t[e]}function o(e,t,o,s,n){var i="_l_geocoder_"+a++;t[n||"callback"]=i,window[i]=d.Util.bind(o,s);var r=document.createElement("script");r.type="text/javascript",r.src=e+l(t),r.id=i,document.getElementsByTagName("head")[0].appendChild(r)}function u(e,t,o){var s=new XMLHttpRequest;s.onreadystatechange=function(){4===s.readyState&&(200===s.status||304===s.status?o(s.response):o(""))},s.open("GET",e+l(t),!0),s.responseType="json",s.setRequestHeader("Accept","application/json"),s.send(null)}function s(e,s){return e.replace(/\{ *([\w_]+) *\}/g,function(e,t){var o=s[t];return void 0===o?o="":"function"==typeof o&&(o=o(s)),function(e){return null==e?"":e?(e=""+e,i.test(e)?e.replace(n,r):e):e+""}(o)})}function l(e,t,o){var s=[];for(var n in e){var i=encodeURIComponent(o?n.toUpperCase():n),r=e[n];if(d.Util.isArray(r))for(var a=0;a<r.length;a++)s.push(i+"="+encodeURIComponent(r[a]));else s.push(i+"="+encodeURIComponent(r))}return(t&&-1!==t.indexOf("?")?"&":"?")+s.join("&")}var c=d.Class.extend({options:{service_url:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"},initialize:function(e,t){d.setOptions(this,t),this._accessToken=e},geocode:function(e,r,a){var t={SingleLine:e,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"};this._key&&this._key.length&&(t.token=this._key),u(this.options.service_url+"/findAddressCandidates",d.extend(t,this.options.geocodingQueryParams),function(e){var t,o,s,n=[];if(e.candidates&&e.candidates.length)for(var i=0;i<=e.candidates.length-1;i++)t=e.candidates[i],o=d.latLng(t.location.y,t.location.x),s=d.latLngBounds(d.latLng(t.extent.ymax,t.extent.xmax),d.latLng(t.extent.ymin,t.extent.xmin)),n[i]={name:t.address,bbox:s,center:o};r.call(a,n)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,s,n){var o={location:encodeURIComponent(e.lng)+","+encodeURIComponent(e.lat),distance:100,f:"json"};u(this.options.service_url+"/reverseGeocode",o,function(e){var t,o=[];e&&!e.error&&(t=d.latLng(e.location.y,e.location.x),o.push({name:e.address.Match_addr,center:t,bounds:d.latLngBounds(t,t)})),s.call(n,o)})}});var p=d.Class.extend({initialize:function(e){this.key=e},geocode:function(e,i,r){o("https://dev.virtualearth.net/REST/v1/Locations",{query:e,key:this.key},function(e){var t=[];if(0<e.resourceSets.length)for(var o=e.resourceSets[0].resources.length-1;0<=o;o--){var s=e.resourceSets[0].resources[o],n=s.bbox;t[o]={name:s.name,bbox:d.latLngBounds([n[0],n[1]],[n[2],n[3]]),center:d.latLng(s.point.coordinates)}}i.call(r,t)},this,"jsonp")},reverse:function(e,t,i,r){o("//dev.virtualearth.net/REST/v1/Locations/"+e.lat+","+e.lng,{key:this.key},function(e){for(var t=[],o=e.resourceSets[0].resources.length-1;0<=o;o--){var s=e.resourceSets[0].resources[o],n=s.bbox;t[o]={name:s.name,bbox:d.latLngBounds([n[0],n[1]],[n[2],n[3]]),center:d.latLng(s.point.coordinates)}}i.call(r,t)},this,"jsonp")}});var h=d.Class.extend({options:{serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e,t){this._key=e,d.setOptions(this,t),this.options.serviceUrl=this.options.service_url||this.options.serviceUrl},geocode:function(e,r,a){var t={address:e};this._key&&this._key.length&&(t.key=this._key),t=d.Util.extend(t,this.options.geocodingQueryParams),u(this.options.serviceUrl,t,function(e){var t,o,s,n=[];if(e.results&&e.results.length)for(var i=0;i<=e.results.length-1;i++)t=e.results[i],o=d.latLng(t.geometry.location),s=d.latLngBounds(d.latLng(t.geometry.viewport.northeast),d.latLng(t.geometry.viewport.southwest)),n[i]={name:t.formatted_address,bbox:s,center:o,properties:t.address_components};r.call(a,n)})},reverse:function(e,t,r,a){var o={latlng:encodeURIComponent(e.lat)+","+encodeURIComponent(e.lng)};o=d.Util.extend(o,this.options.reverseQueryParams),this._key&&this._key.length&&(o.key=this._key),u(this.options.serviceUrl,o,function(e){var t,o,s,n=[];if(e.results&&e.results.length)for(var i=0;i<=e.results.length-1;i++)t=e.results[i],o=d.latLng(t.geometry.location),s=d.latLngBounds(d.latLng(t.geometry.viewport.northeast),d.latLng(t.geometry.viewport.southwest)),n[i]={name:t.formatted_address,bbox:s,center:o,properties:t.address_components};r.call(a,n)})}});var g=d.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:"<insert your app_id here>",app_code:"<insert your app_code here>",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e){d.setOptions(this,e)},geocode:function(e,t,o){var s={searchtext:e,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1};s=d.Util.extend(s,this.options.geocodingQueryParams),this.getJSON(this.options.geocodeUrl,s,t,o)},reverse:function(e,t,o,s){var n={prox:encodeURIComponent(e.lat)+","+encodeURIComponent(e.lng),mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1};n=d.Util.extend(n,this.options.reverseQueryParams),this.getJSON(this.options.reverseGeocodeUrl,n,o,s)},getJSON:function(e,t,r,a){u(e,t,function(e){var t,o,s,n=[];if(e.response.view&&e.response.view.length)for(var i=0;i<=e.response.view[0].result.length-1;i++)t=e.response.view[0].result[i].location,o=d.latLng(t.displayPosition.latitude,t.displayPosition.longitude),s=d.latLngBounds(d.latLng(t.mapView.topLeft.latitude,t.mapView.topLeft.longitude),d.latLng(t.mapView.bottomRight.latitude,t.mapView.bottomRight.longitude)),n[i]={name:t.address.label,bbox:s,center:o};r.call(a,n)})}});var m=d.Class.extend({options:{next:void 0,sizeInMeters:1e4},initialize:function(e){d.Util.setOptions(this,e)},geocode:function(e,t,o){var s,n;if((s=e.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?n=d.latLng((/N/i.test(s[1])?1:-1)*parseFloat(s[2]),(/E/i.test(s[3])?1:-1)*parseFloat(s[4])):(s=e.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?n=d.latLng((/N/i.test(s[2])?1:-1)*parseFloat(s[1]),(/E/i.test(s[4])?1:-1)*parseFloat(s[3])):(s=e.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?n=d.latLng((/N/i.test(s[1])?1:-1)*(parseFloat(s[2])+parseFloat(s[3]/60)),(/E/i.test(s[4])?1:-1)*(parseFloat(s[5])+parseFloat(s[6]/60))):(s=e.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?n=d.latLng((/N/i.test(s[3])?1:-1)*(parseFloat(s[1])+parseFloat(s[2]/60)),(/E/i.test(s[6])?1:-1)*(parseFloat(s[4])+parseFloat(s[5]/60))):(s=e.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/))?n=d.latLng((/N/i.test(s[1])?1:-1)*(parseFloat(s[2])+parseFloat(s[3]/60+parseFloat(s[4]/3600))),(/E/i.test(s[5])?1:-1)*(parseFloat(s[6])+parseFloat(s[7]/60)+parseFloat(s[8]/3600))):(s=e.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/))?n=d.latLng((/N/i.test(s[4])?1:-1)*(parseFloat(s[1])+parseFloat(s[2]/60+parseFloat(s[3]/3600))),(/E/i.test(s[8])?1:-1)*(parseFloat(s[5])+parseFloat(s[6]/60)+parseFloat(s[7]/3600))):(s=e.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))&&(n=d.latLng(parseFloat(s[1]),parseFloat(s[2]))),n){var i=[{name:e,center:n,bbox:n.toBounds(this.options.sizeInMeters)}];t.call(o,i)}else this.options.next&&this.options.next.geocode(e,t,o)}});var v=d.Class.extend({options:{serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e,t){d.setOptions(this,t),this.options.geocodingQueryParams.access_token=e,this.options.reverseQueryParams.access_token=e},geocode:function(e,l,c){var t=this.options.geocodingQueryParams;void 0!==t.proximity&&t.proximity.hasOwnProperty("lat")&&t.proximity.hasOwnProperty("lng")&&(t.proximity=t.proximity.lng+","+t.proximity.lat),u(this.options.serviceUrl+encodeURIComponent(e)+".json",t,function(e){var t,o,s,n=[];if(e.features&&e.features.length)for(var i=0;i<=e.features.length-1;i++){t=e.features[i],o=d.latLng(t.center.reverse()),s=t.hasOwnProperty("bbox")?d.latLngBounds(d.latLng(t.bbox.slice(0,2).reverse()),d.latLng(t.bbox.slice(2,4).reverse())):d.latLngBounds(o,o);for(var r={text:t.text,address:t.address},a=0;a<t.context.length;a++){r[t.context[a].id.split(".")[0]]=t.context[a].text}n[i]={name:t.place_name,bbox:s,center:o,properties:r}}l.call(c,n)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,r,a){u(this.options.serviceUrl+encodeURIComponent(e.lng)+","+encodeURIComponent(e.lat)+".json",this.options.reverseQueryParams,function(e){var t,o,s,n=[];if(e.features&&e.features.length)for(var i=0;i<=e.features.length-1;i++)t=e.features[i],o=d.latLng(t.center.reverse()),s=t.hasOwnProperty("bbox")?d.latLngBounds(d.latLng(t.bbox.slice(0,2).reverse()),d.latLng(t.bbox.slice(2,4).reverse())):d.latLngBounds(o,o),n[i]={name:t.place_name,bbox:s,center:o};r.call(a,n)})}});var f=d.Class.extend({options:{serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},initialize:function(e,t){this._key=decodeURIComponent(e),d.Util.setOptions(this,t)},_formatName:function(){var e,t=[];for(e=0;e<arguments.length;e++)arguments[e]&&t.push(arguments[e]);return t.join(", ")},geocode:function(e,i,r){u(this.options.serviceUrl+"/address",{key:this._key,location:e,limit:5,outFormat:"json"},d.bind(function(e){var t,o,s=[];if(e.results&&e.results[0].locations)for(var n=e.results[0].locations.length-1;0<=n;n--)t=e.results[0].locations[n],o=d.latLng(t.latLng),s[n]={name:this._formatName(t.street,t.adminArea4,t.adminArea3,t.adminArea1),bbox:d.latLngBounds(o,o),center:o};i.call(r,s)},this))},reverse:function(e,t,i,r){u(this.options.serviceUrl+"/reverse",{key:this._key,location:e.lat+","+e.lng,outputFormat:"json"},d.bind(function(e){var t,o,s=[];if(e.results&&e.results[0].locations)for(var n=e.results[0].locations.length-1;0<=n;n--)t=e.results[0].locations[n],o=d.latLng(t.latLng),s[n]={name:this._formatName(t.street,t.adminArea4,t.adminArea3,t.adminArea1),bbox:d.latLngBounds(o,o),center:o};i.call(r,s)},this))}});var _=d.Class.extend({options:{userId:"<insert your userId here>",apiKey:"<insert your apiKey here>",serviceUrl:"https://neutrinoapi.com/"},initialize:function(e){d.Util.setOptions(this,e)},geocode:function(e,n,i){u(this.options.serviceUrl+"geocode-address",{apiKey:this.options.apiKey,userId:this.options.userId,address:e.split(/\s+/).join(".")},function(e){var t,o,s=[];e.hasOwnProperty("locations")&&(e.geometry=e.locations[0],t=d.latLng(e.geometry.latitude,e.geometry.longitude),o=d.latLngBounds(t,t),s[0]={name:e.geometry.address,bbox:o,center:t}),n.call(i,s)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(n,e,i,r){u(this.options.serviceUrl+"geocode-reverse",{apiKey:this.options.apiKey,userId:this.options.userId,latitude:n.lat,longitude:n.lng},function(e){var t,o,s=[];200==e.status.status&&e.found&&(t=d.latLng(n.lat,n.lng),o=d.latLngBounds(t,t),s[0]={name:e.address,bbox:o,center:t}),i.call(r,s)})}});var b=d.Class.extend({options:{serviceUrl:"https://nominatim.openstreetmap.org/",geocodingQueryParams:{},reverseQueryParams:{},htmlTemplate:function(e){var t=e.address,o=[];return(t.road||t.building)&&o.push("{building} {road} {house_number}"),(t.city||t.town||t.village||t.hamlet)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(t.state||t.country)&&o.push('<span class="'+(0<o.length?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),s(o.join("<br/>"),t)}},initialize:function(e){d.Util.setOptions(this,e)},geocode:function(e,i,r){u(this.options.serviceUrl+"search",d.extend({q:e,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),d.bind(function(e){for(var t=[],o=e.length-1;0<=o;o--){for(var s=e[o].boundingbox,n=0;n<4;n++)s[n]=parseFloat(s[n]);t[o]={icon:e[o].icon,name:e[o].display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(e[o]):void 0,bbox:d.latLngBounds([s[0],s[2]],[s[1],s[3]]),center:d.latLng(e[o].lat,e[o].lon),properties:e[o]}}i.call(r,t)},this))},reverse:function(e,t,s,n){u(this.options.serviceUrl+"reverse",d.extend({lat:e.lat,lon:e.lng,zoom:Math.round(Math.log(t/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),d.bind(function(e){var t,o=[];e&&e.lat&&e.lon&&(t=d.latLng(e.lat,e.lon),o.push({name:e.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(e):void 0,center:t,bounds:d.latLngBounds(t,t),properties:e})),s.call(n,o)},this))}});var y=d.Class.extend({options:{OpenLocationCode:void 0,codeLength:void 0},initialize:function(e){d.setOptions(this,e)},geocode:function(e,t,o){try{var s=this.options.OpenLocationCode.decode(e),n={name:e,center:d.latLng(s.latitudeCenter,s.longitudeCenter),bbox:d.latLngBounds(d.latLng(s.latitudeLo,s.longitudeLo),d.latLng(s.latitudeHi,s.longitudeHi))};t.call(o,[n])}catch(e){console.warn(e),t.call(o,[])}},reverse:function(e,t,o,s){try{var n={name:this.options.OpenLocationCode.encode(e.lat,e.lng,this.options.codeLength),center:d.latLng(e.lat,e.lng),bbox:d.latLngBounds(d.latLng(e.lat,e.lng),d.latLng(e.lat,e.lng))};o.call(s,[n])}catch(e){console.warn(e),o.call(s,[])}}});var L=d.Class.extend({options:{serviceUrl:"https://api.geocode.earth/v1",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e,t){d.Util.setOptions(this,t),this._apiKey=e,this._lastSuggest=0},geocode:function(e,t,o){var s=this;u(this.options.serviceUrl+"/search",d.extend({api_key:this._apiKey,text:e},this.options.geocodingQueryParams),function(e){t.call(o,s._parseResults(e,"bbox"))})},suggest:function(e,t,o){var s=this;u(this.options.serviceUrl+"/autocomplete",d.extend({api_key:this._apiKey,text:e},this.options.geocodingQueryParams),d.bind(function(e){e.geocoding.timestamp>this._lastSuggest&&(this._lastSuggest=e.geocoding.timestamp,t.call(o,s._parseResults(e,"bbox")))},this))},reverse:function(e,t,o,s){var n=this;u(this.options.serviceUrl+"/reverse",d.extend({api_key:this._apiKey,"point.lat":e.lat,"point.lon":e.lng},this.options.reverseQueryParams),function(e){o.call(s,n._parseResults(e,"bounds"))})},_parseResults:function(e,i){var r=[];return d.geoJson(e,{pointToLayer:function(e,t){return d.circleMarker(t)},onEachFeature:function(e,t){var o,s,n={};t.getBounds?s=(o=t.getBounds()).getCenter():o=t.feature.bbox?(s=t.getLatLng(),d.latLngBounds(d.GeoJSON.coordsToLatLng(t.feature.bbox.slice(0,2)),d.GeoJSON.coordsToLatLng(t.feature.bbox.slice(2,4)))):(s=t.getLatLng(),d.latLngBounds(s,s)),n.name=t.feature.properties.label,n.center=s,n[i]=o,n.properties=t.feature.properties,r.push(n)}}),r}});function e(e,t){return new L(e,t)}var x=L,U=e,C=L,w=e,k=C.extend({options:{serviceUrl:"https://api.openrouteservice.org/geocode"}});var D=d.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(e){d.setOptions(this,e)},geocode:function(e,t,o){var s=d.extend({q:e},this.options.geocodingQueryParams);u(this.options.serviceUrl,s,d.bind(function(e){t.call(o,this._decodeFeatures(e))},this))},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,o,s){var n=d.extend({lat:e.lat,lon:e.lng},this.options.reverseQueryParams);u(this.options.reverseUrl,n,d.bind(function(e){o.call(s,this._decodeFeatures(e))},this))},_decodeFeatures:function(e){var t,o,s,n,i,r,a=[];if(e&&e.features)for(t=0;t<e.features.length;t++)s=(o=e.features[t]).geometry.coordinates,n=d.latLng(s[1],s[0]),r=(i=o.properties.extent)?d.latLngBounds([i[1],i[0]],[i[3],i[2]]):d.latLngBounds(n,n),a.push({name:this._decodeFeatureName(o),html:this.options.htmlTemplate?this.options.htmlTemplate(o):void 0,center:n,bbox:r,properties:o.properties});return a},_decodeFeatureName:function(t){return(this.options.nameProperties||[]).map(function(e){return t.properties[e]}).filter(function(e){return!!e}).join(", ")}});var E=d.Class.extend({options:{serviceUrl:"https://api.what3words.com/v2/"},initialize:function(e){this._accessToken=e},geocode:function(e,n,i){u(this.options.serviceUrl+"forward",{key:this._accessToken,addr:e.split(/\s+/).join(".")},function(e){var t,o,s=[];e.hasOwnProperty("geometry")&&(t=d.latLng(e.geometry.lat,e.geometry.lng),o=d.latLngBounds(t,t),s[0]={name:e.words,bbox:o,center:t}),n.call(i,s)})},suggest:function(e,t,o){return this.geocode(e,t,o)},reverse:function(e,t,n,i){u(this.options.serviceUrl+"reverse",{key:this._accessToken,coords:[e.lat,e.lng].join(",")},function(e){var t,o,s=[];200==e.status.status&&(t=d.latLng(e.geometry.lat,e.geometry.lng),o=d.latLngBounds(t,t),s[0]={name:e.words,bbox:o,center:t}),n.call(i,s)})}});var P=Object.freeze({ArcGis:c,arcgis:function(e,t){return new c(e,t)},Bing:p,bing:function(e){return new p(e)},Google:h,google:function(e,t){return new h(e,t)},HERE:g,here:function(e){return new g(e)},LatLng:m,latLng:function(e){return new m(e)},Mapbox:v,mapbox:function(e,t){return new v(e,t)},MapQuest:f,mapQuest:function(e,t){return new f(e,t)},Neutrino:_,neutrino:function(e){return new _(e)},Nominatim:b,nominatim:function(e){return new b(e)},OpenLocationCode:y,openLocationCode:function(e){return new y(e)},Pelias:L,pelias:e,GeocodeEarth:x,geocodeEarth:U,Mapzen:C,mapzen:w,Openrouteservice:k,openrouteservice:function(e,t){return new k(e,t)},Photon:D,photon:function(e){return new D(e)},What3Words:E,what3words:function(e){return new E(e)}}),T=d.Control.extend({options:{showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},includes:d.Evented.prototype||d.Mixin.Events,initialize:function(e){d.Util.setOptions(this,e),this.options.geocoder||(this.options.geocoder=new b),this._requestCount=0},addThrobberClass:function(){d.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},removeThrobberClass:function(){d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},onAdd:function(e){var t,o="leaflet-control-geocoder",s=d.DomUtil.create("div",o+" leaflet-bar"),n=d.DomUtil.create("button",o+"-icon",s),i=this._form=d.DomUtil.create("div",o+"-form",s);return this._map=e,this._container=s,n.innerHTML="&nbsp;",n.type="button",(t=this._input=d.DomUtil.create("input","",i)).type="text",t.placeholder=this.options.placeholder,d.DomEvent.disableClickPropagation(t),this._errorElement=d.DomUtil.create("div",o+"-form-no-error",s),this._errorElement.innerHTML=this.options.errorMessage,this._alts=d.DomUtil.create("ul",o+"-alternatives leaflet-control-geocoder-alternatives-minimized",s),d.DomEvent.disableClickPropagation(this._alts),d.DomEvent.addListener(t,"keydown",this._keydown,this),this.options.geocoder.suggest&&d.DomEvent.addListener(t,"input",this._change,this),d.DomEvent.addListener(t,"blur",function(){this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1},this),this.options.collapsed?"click"===this.options.expand?d.DomEvent.addListener(s,"click",function(e){0===e.button&&2!==e.detail&&this._toggle()},this):d.Browser.touch&&"touch"===this.options.expand?d.DomEvent.addListener(s,"touchstart mousedown",function(e){this._toggle(),e.preventDefault(),e.stopPropagation()},this):(d.DomEvent.addListener(s,"mouseover",this._expand,this),d.DomEvent.addListener(s,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),d.Browser.touch?d.DomEvent.addListener(s,"touchstart",function(){this._geocode()},this):d.DomEvent.addListener(s,"click",function(){this._geocode()},this)),this.options.defaultMarkGeocode&&this.on("markgeocode",this.markGeocode,this),this.on("startgeocode",this.addThrobberClass,this),this.on("finishgeocode",this.removeThrobberClass,this),this.on("startsuggest",this.addThrobberClass,this),this.on("finishsuggest",this.removeThrobberClass,this),d.DomEvent.disableClickPropagation(s),s},_geocodeResult:function(e,t){if(t||1!==e.length)if(0<e.length){this._alts.innerHTML="",this._results=e,d.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),d.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var o=0;o<e.length;o++)this._alts.appendChild(this._createAlt(e[o],o))}else d.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),d.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error");else this._geocodeResultSelected(e[0])},markGeocode:function(e){return e=e.geocode||e,this._map.fitBounds(e.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new d.Marker(e.center).bindPopup(e.html||e.name).addTo(this._map).openPopup(),this},_geocode:function(t){var e=this._input.value;if(t||!(e.length<this.options.queryMinLength)){var o=++this._requestCount,s=t?"suggest":"geocode",n={input:e};this._lastGeocode=e,t||this._clearResults(),this.fire("start"+s,n),this.options.geocoder[s](e,function(e){o===this._requestCount&&(n.results=e,this.fire("finish"+s,n),this._geocodeResult(e,t))},this)}},_geocodeResultSelected:function(e){this.fire("markgeocode",{geocode:e})},_toggle:function(){d.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},_expand:function(){d.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},_collapse:function(){d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),d.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),d.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},_clearResults:function(){d.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,d.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),d.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},_createAlt:function(t,e){var o=d.DomUtil.create("li",""),s=d.DomUtil.create("a","",o),n=this.options.showResultIcons&&t.icon?d.DomUtil.create("img","",s):null,i=t.html?void 0:document.createTextNode(t.name);return n&&(n.src=t.icon),o.setAttribute("data-result-index",e),t.html?s.innerHTML=s.innerHTML+t.html:s.appendChild(i),d.DomEvent.addListener(o,"mousedown touchstart",function(e){this._preventBlurCollapse=!0,d.DomEvent.stop(e),this._geocodeResultSelected(t),d.DomEvent.on(o,"click",function(){this.options.collapsed?this._collapse():this._clearResults()},this)},this),o},_keydown:function(e){function t(e){o._selection&&(d.DomUtil.removeClass(o._selection,"leaflet-control-geocoder-selected"),o._selection=o._selection[0<e?"nextSibling":"previousSibling"]),o._selection||(o._selection=o._alts[0<e?"firstChild":"lastChild"]),o._selection&&d.DomUtil.addClass(o._selection,"leaflet-control-geocoder-selected")}var o=this;switch(e.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:t(-1);break;case 40:t(1);break;case 13:if(this._selection){var s=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[s]),this._clearResults()}else this._geocode();break;default:return}d.DomEvent.preventDefault(e)},_change:function(){var e=this._input.value;e!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),e.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(d.bind(function(){this._geocode(!0)},this),this.options.suggestTimeout):this._clearResults())}});return d.Util.extend(T,P),d.Util.extend(d.Control,{Geocoder:T,geocoder:function(e){return new T(e)}}),T}(L);
//# sourceMappingURL=Control.Geocoder.min.js.map
{
"name": "leaflet-control-geocoder",
"version": "1.8.0",
"version": "1.8.2",
"description": "Extendable geocoder with builtin support for OpenStreetMap Nominatim, Bing, Google, Mapbox, MapQuest, What3Words, Photon, Pelias, HERE, Neutrino, Plus codes",

@@ -9,6 +9,8 @@ "main": "dist/Control.Geocoder.js",

"prepare": "npm run build",
"build": "npm run build:js && npm run build:css && npm run build:img",
"build": "npm run build:js && npm run build:css && npm run build:img && npm run build:demo-rollup && npm run build:demo-webpack",
"build:js": "rollup -c",
"build:css": "cpr Control.Geocoder.css dist/Control.Geocoder.css --overwrite",
"build:img": "cpr images/ dist/images/ --overwrite",
"build:demo-rollup": "cd demo-rollup && npm install && npm run build",
"build:demo-webpack": "cd demo-rollup && npm install && npm run build",
"test": "npm run test:karma -- --single-run && npm run lint",

@@ -20,3 +22,3 @@ "test:karma": "karma start spec/karma.conf.js",

"fix:style": "prettier --write $(npm run ls-files)",
"ls-files": "git ls-files '*.js' '*.json' '*.css' '*.html' '*.yaml' '*.yml'",
"ls-files": "git ls-files '*.js' '*.json' '*.css' '*.html' '*.yaml' '*.yml' '*.md'",
"publish": "sh ./scripts/publish.sh",

@@ -23,0 +25,0 @@ "postpublish": "sh ./scripts/postpublish.sh"

@@ -9,4 +9,3 @@ ## A few words on diversity in tech

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)
=============================
# 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)

@@ -17,21 +16,26 @@ A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim).

* LatLng to parse basic latitude/longitude strings
* [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/api-documentation/#geocoding)
* [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
* [What3Words](http://what3words.com/)
* [Photon](http://photon.komoot.de/)
* [Pelias](https://pelias.io/), [geocode.earth](https://geocode.earth/) (formerly Mapzen Search), [Openrouteservice](https://openrouteservice.org/dev/#/api-docs/geocode)
* [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html)
* [Neutrino API](https://www.neutrinoapi.com/api/geocode-address/)
* [Plus codes](https://plus.codes/) (formerly OpenLocationCode) (requires [open-location-code](https://www.npmjs.com/package/open-location-code))
- LatLng to parse basic latitude/longitude strings
- [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/api-documentation/#geocoding)
- [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
- [What3Words](http://what3words.com/)
- [Photon](http://photon.komoot.de/)
- [Pelias](https://pelias.io/), [geocode.earth](https://geocode.earth/) (formerly Mapzen Search), [Openrouteservice](https://openrouteservice.org/dev/#/api-docs/geocode)
- [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html)
- [Neutrino API](https://www.neutrinoapi.com/api/geocode-address/)
- [Plus codes](https://plus.codes/) (formerly OpenLocationCode) (requires [open-location-code](https://www.npmjs.com/package/open-location-code))
The plugin can easily be extended to support other providers. Current extensions:
* [DAWA Geocoder](https://github.com/kjoller/leaflet-control-geocoder-dawa/tree/new) - support for Danish Address Web API by [Niels Kjøller Hansen](https://github.com/kjoller)
- [DAWA Geocoder](https://github.com/kjoller/leaflet-control-geocoder-dawa/tree/new) - support for Danish Address Web API by [Niels Kjøller Hansen](https://github.com/kjoller)
See the [Leaflet Control Geocoder Demo](https://www.liedman.net/leaflet-control-geocoder/).
# Demos
- [Leaflet Control Geocoder Demo](https://www.liedman.net/leaflet-control-geocoder/) hosted on liedman.net
- See [demo/](https://github.com/perliedman/leaflet-control-geocoder/tree/master/demo)
- See [demo-rollup/](https://github.com/perliedman/leaflet-control-geocoder/tree/master/demo-rollup) using the [rollup.js](https://rollupjs.org/) bundler
- See [demo-webpack/](https://github.com/perliedman/leaflet-control-geocoder/tree/master/demo-rollup) using the [webpack](https://webpack.js.org/) bundler
# Usage

@@ -51,3 +55,3 @@

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

@@ -68,15 +72,15 @@ L.Control.geocoder().addTo(map);

var geocoder = L.Control.geocoder({
defaultMarkGeocode: false
})
.on('markgeocode', function(e) {
var bbox = e.geocode.bbox;
var poly = L.polygon([
bbox.getSouthEast(),
bbox.getNorthEast(),
bbox.getNorthWest(),
bbox.getSouthWest()
]).addTo(map);
map.fitBounds(poly.getBounds());
})
.addTo(map);
defaultMarkGeocode: false
})
.on('markgeocode', function(e) {
var bbox = e.geocode.bbox;
var poly = L.polygon([
bbox.getSouthEast(),
bbox.getNorthEast(),
bbox.getNorthWest(),
bbox.getSouthWest()
]).addTo(map);
map.fitBounds(poly.getBounds());
})
.addTo(map);
```

@@ -97,5 +101,5 @@

```js
new L.Control.Geocoder(options)
new L.Control.Geocoder(options);
// or
L.Control.geocoder(options)
L.Control.geocoder(options);
```

@@ -105,20 +109,20 @@

| 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 |
| `suggestMinLength`| Number | `3` | Minimum number characters before suggest functionality is used (if available from geocoder) |
| `suggestTimeout` | Number | `250` | Number of milliseconds after typing stopped before suggest functionality is used (if available from geocoder) |
| `queryMinLength` | Number | `1` | Minimum number of characters in search text before performing a query |
| 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 |
| `suggestMinLength` | Number | `3` | Minimum number characters before suggest functionality is used (if available from geocoder) |
| `suggestTimeout` | Number | `250` | Number of milliseconds after typing stopped before suggest functionality is used (if available from geocoder) |
| `queryMinLength` | Number | `1` | Minimum number of characters in search text before performing a query |
### Methods
| Method | Returns | Description |
| ------------------------------------- | ------------------- | ----------------- |
| `markGeocode(<GeocodingResult> result)` | `this` | Marks a geocoding result on the map |
| Method | Returns | Description |
| --------------------------------------- | ------- | ----------------------------------- |
| `markGeocode(<GeocodingResult> result)` | `this` | Marks a geocoding result on the map |

@@ -128,3 +132,3 @@ ## L.Control.Geocoder.Nominatim

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```.
geocoding service used by the control, unless otherwise specified in the options. Implements `IGeocoder`.

@@ -136,5 +140,5 @@ Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/).

```js
new L.Control.Geocoder.Nominatim(options)
new L.Control.Geocoder.Nominatim(options);
// or
L.Control.Geocoder.nominatim(options)
L.Control.Geocoder.nominatim(options);
```

@@ -144,12 +148,12 @@

| Option | Type | Default | Description |
| --------------- | ---------------- | ----------------- | ----------- |
| `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
| Option | Type | Default | Description |
| ---------------------- | -------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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
Uses [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx) to respond to geocoding queries. Implements ```IGeocoder```.
Uses [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx) to respond to geocoding queries. Implements `IGeocoder`.

@@ -161,5 +165,5 @@ Note that you need an API key to use this service.

```ts
new L.Control.Geocoder.Bing(<String> key)
new L.Control.Geocoder.Bing(<String>key);
// or
L.Control.Geocoder.bing(<String> key)
L.Control.Geocoder.bing(<String>key);
```

@@ -174,5 +178,5 @@

```ts
new L.Control.Geocoder.LatLng(options)
new L.Control.Geocoder.LatLng(options);
// or
L.Control.Geocoder.latLng(options)
L.Control.Geocoder.latLng(options);
```

@@ -182,6 +186,6 @@

| Option | Type | Default | Description |
| --------------- | --------- | -------- | ----------- |
| `next` | IGeocoder | | The next geocoder to use for non-supported queries. |
| `sizeInMeters` | Number | 10000 | The size in meters used for passing to `LatLng.toBounds`. |
| Option | Type | Default | Description |
| -------------- | --------- | ------- | --------------------------------------------------------- |
| `next` | IGeocoder | | The next geocoder to use for non-supported queries. |
| `sizeInMeters` | Number | 10000 | The size in meters used for passing to `LatLng.toBounds`. |

@@ -194,7 +198,7 @@ ## IGeocoder

| Method | Returns | Description |
| ------------------------------------- | ------------------- | ----------------- |
| `geocode(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query and returns the results to the callback in the provided context |
| `suggest(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query suggestion (this happens while typing) and returns the results to the callback in the provided context |
| `reverse(<L.LatLng> location, <Number> scale, callback, context)` | `GeocodingResult[]` | Performs a reverse geocoding query and returns the results to the callback in the provided context |
| Method | Returns | Description |
| ----------------------------------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `geocode(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query and returns the results to the callback in the provided context |
| `suggest(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query suggestion (this happens while typing) and returns the results to the callback in the provided context |
| `reverse(<L.LatLng> location, <Number> scale, callback, context)` | `GeocodingResult[]` | Performs a reverse geocoding query and returns the results to the callback in the provided context |

@@ -207,8 +211,8 @@ ## GeocodingResult

| 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 |

@@ -23,3 +23,3 @@ import L from 'leaflet';

if (!this.options.geocoder) {
this.options.geocoder = new Nominatim.class();
this.options.geocoder = new Nominatim();
}

@@ -26,0 +26,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc