mirror of
https://github.com/netzmacht/contao-leaflet-libraries.git
synced 2026-10-14 06:35:59 +02:00
Update leaflet-control-geocoder to version 1.13.0
This commit is contained in:
1 parent
8045cdc07a
commit
996a3fb745
8 files changed
+1522
-1003
No files matched your search
@@ -18,7 +18,7 @@ This package contains following packages:
|
|||||||
- [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore)
|
- [Leaflet-omnivore 0.3.4](https://github.com/mapbox/leaflet-omnivore)
|
||||||
- [Leaflet.loading 0.1.24](https://github.com/ebrelsford/Leaflet.loading)
|
- [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.FullScreen 1.4.5](https://github.com/brunob/leaflet.fullscreen)
|
||||||
- [Leaflet Control Geocoder 1.6.0](https://github.com/perliedman/leaflet-control-geocoder)
|
- [Leaflet Control Geocoder 1.13.0](https://github.com/perliedman/leaflet-control-geocoder)
|
||||||
- [Leaflet.ExtraMarkers 1.0.8](https://github.com/coryasilva/Leaflet.ExtraMarkers)
|
- [Leaflet.ExtraMarkers 1.0.8](https://github.com/coryasilva/Leaflet.ExtraMarkers)
|
||||||
- [leaflet.pm 0.25.0](https://github.com/codeofsumit/leaflet.pm)
|
- [leaflet.pm 0.25.0](https://github.com/codeofsumit/leaflet.pm)
|
||||||
- [osmtogeojson 2.2.12](https://github.com/tyrasd/osmtogeojson)
|
- [osmtogeojson 2.2.12](https://github.com/tyrasd/osmtogeojson)
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1 +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 '<span class=\"' +\n (parts.length > 0 ? 'leaflet-control-geocoder-address-detail' : '') +\n '\">{postcode} {city} {town} {village} {hamlet}</span>'\n );\n }\n\n if (a.state || a.country) {\n parts.push(\n '<span class=\"' +\n (parts.length > 0 ? 'leaflet-control-geocoder-address-context' : '') +\n '\">{state} {country}</span>'\n );\n }\n\n return template(parts.join('<br/>'), 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.Line truncated
|
{"version":3,"file":"Control.Geocoder.js","sources":["../src/util.js","../src/geocoders/arcgis.js","../src/geocoders/bing.js","../src/geocoders/google.js","../src/geocoders/here.js","../src/geocoders/latlng.js","../src/geocoders/mapbox.js","../src/geocoders/mapquest.js","../src/geocoders/neutrino.js","../src/geocoders/nominatim.js","../src/geocoders/open-location-code.js","../src/geocoders/opencage.js","../src/geocoders/pelias.js","../src/geocoders/photon.js","../src/geocoders/what3words.js","../src/control.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 + 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 var message;\n if (xmlHttp.status !== 200 && xmlHttp.status !== 304) {\n message = '';\n } else if (typeof xmlHttp.response === 'string') {\n // IE doesn't parse JSON responses even with responseType: 'json'.\n try {\n message = JSON.parse(xmlHttp.response);\n } catch (e) {\n // Not a JSON response\n message = xmlHttp.response;\n }\n } else {\n message = xmlHttp.response;\n }\n callback(message);\n };\n xmlHttp.open('GET', url + getParamString(params), true);\n xmlHttp.responseType = 'json';\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\nexport function getParamString(obj, existingUrl, uppercase) {\n var params = [];\n for (var i in obj) {\n var key = encodeURIComponent(uppercase ? i.toUpperCase() : i);\n var value = obj[i];\n if (!L.Util.isArray(value)) {\n params.push(key + '=' + encodeURIComponent(value));\n } else {\n for (var j = 0; j < value.length; j++) {\n params.push(key + '=' + encodeURIComponent(value[j]));\n }\n }\n }\n return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');\n}\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport var ArcGis = L.Class.extend({\n options: {\n service_url: 'https://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(\n this.options.service_url + '/findAddressCandidates',\n L.extend(params, this.options.geocodingQueryParams),\n 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 };Line truncated
|
||||||
+10
-1
@@ -1 +1,10 @@
|
|||||||
this.L=this.L||{},this.L.Control=this.L.Control||{},this.L.Control.Geocoder=function(l){"use strict";l=l&&l.hasOwnProperty("default")?l.default:l;var a=0,i=/[&<>"'`]/g,r=/[&<>"'`]/,t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function c(e){return t[e]}function o(e,t,o,s,n){var i="_l_geocoder_"+a++;t[n||"callback"]=i,window[i]=l.Util.bind(o,s);var r=document.createElement("script");r.type="text/javascript",r.src=e+l.Util.getParamString(t),r.id=i,document.getElementsByTagName("head")[0].appendChild(r)}function d(e,t,o){var s=new XMLHttpRequest;s.onreadystatechange=function(){4===s.readyState&&(200===s.status||304===s.status?o(JSON.parse(s.response)):o(""))},s.open("GET",e+l.Util.getParamString(t),!0),s.setRequestHeader("Accept","application/json"),s.send(null)}function s(e,n){return e.replace(/\{ *([\w_]+) *\}/g,function(e,t){var o,s=n[t];return void 0===s?s="":"function"==typeof s&&(s=s(n)),null==(o=s)?"":o?(o=""+o,r.test(o)?o.replace(i,c):o):o+""})}var n={class:l.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){l.Util.setOptions(this,e)},geocode:function(e,i,r){d(this.options.serviceUrl+"search",l.extend({q:e,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),l.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:l.latLngBounds([s[0],s[2]],[s[1],s[3]]),center:l.latLng(e[o].lat,e[o].lon),properties:e[o]}}i.call(r,t)},this))},reverse:function(e,t,s,n){d(this.options.serviceUrl+"reverse",l.extend({lat:e.lat,lon:e.lng,zoom:Math.round(Math.log(t/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),l.bind(function(e){var t,o=[];e&&e.lat&&e.lon&&(t=l.latLng(e.lat,e.lon),o.push({name:e.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(e):void 0,center:t,bounds:l.latLngBounds(t,t),properties:e})),s.call(n,o)},this))}}),factory:function(e){return new l.Control.Geocoder.Nominatim(e)}},e={class:l.Control.extend({options:{showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},includes:l.Evented.prototype||l.Mixin.Events,initialize:function(e){l.Util.setOptions(this,e),this.options.geocoder||(this.options.geocoder=new n.class),this._requestCount=0},onAdd:function(e){var t,o="leaflet-control-geocoder",s=l.DomUtil.create("div",o+" leaflet-bar"),n=l.DomUtil.create("button",o+"-icon",s),i=this._form=l.DomUtil.create("div",o+"-form",s);return this._map=e,this._container=s,n.innerHTML=" ",n.type="button",(t=this._input=l.DomUtil.create("input","",i)).type="text",t.placeholder=this.options.placeholder,this._errorElement=l.DomUtil.create("div",o+"-form-no-error",s),this._errorElement.innerHTML=this.options.errorMessage,this._alts=l.DomUtil.create("ul",o+"-alternatives leaflet-control-geocoder-alternatives-minimized",s),l.DomEvent.disableClickPropagation(this._alts),l.DomEvent.addListener(t,"keydown",this._keydown,this),this.options.geocoder.suggest&&l.DomEvent.addListener(t,"input",this._change,this),l.DomEvent.addListener(t,"blur",function(){this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1},this),this.options.collapsed?"click"===this.options.expand?l.DomEvent.addListener(s,"click",function(e){0===e.button&&2!==e.detail&&this._toggle()},this):l.Browser.touch&&"touch"===this.options.expand?l.DomEvent.addListener(s,"touchstart mousedown",function(e){this._toggle(),e.preventDefault(),e.stopPropagation()},this):(l.DomEvent.addListener(s,"mouseover",this._expand,this),l.DomEvent.addListener(s,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),l.Browser.touch?l.DomEvent.addListener(s,"touchstart",function(){this._geocode()},this):l.DomEvent.addListener(s,"click",function(){this._geocode()},this)),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(s),s},_geocodeResult:function(e,t){if(t||1!==e.length)if(0<e.length)Line truncated
|
/* @preserve
|
||||||
|
* Leaflet Control Geocoder 1.13.0
|
||||||
|
* https://github.com/perliedman/leaflet-control-geocoder
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 sa3m (https://github.com/sa3m)
|
||||||
|
* Copyright (c) 2018 Per Liedman
|
||||||
|
* All rights reserved.
|
||||||
|
*/
|
||||||
|
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,i=/[&<>"'`]/g,r=/[&<>"'`]/,t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function l(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+c(t),r.id=i,document.getElementsByTagName("head")[0].appendChild(r)}function u(e,t,o){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(4===s.readyState){var t;if(200!==s.status&&304!==s.status)t="";else if("string"==typeof s.response)try{t=JSON.parse(s.response)}catch(e){t=s.response}else t=s.response;o(t)}},s.open("GET",e+c(t),!0),s.responseType="json",s.setRequestHeader("Accept","application/json"),s.send(null)}function n(e,n){return e.replace(/\{ *([\w_]+) *\}/g,function(e,t){var o,s=n[t];return void 0===s?s="":"function"==typeof s&&(s=s(n)),null==(o=s)?"":o?(o=""+o,r.test(o)?o.replace(i,l):o):o+""})}function c(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 s=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 h=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 p=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:"https://geocoder.api.here.com/6.2/geocode.json",reverseGeocodeUrl:"https://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:{},reverseGeocodeProxRadius:null},initialize:function(e){d.setOptions(this,e)},geocode:function(e,t,o){varLine truncated
|
||||||
|
//# sourceMappingURL=Control.Geocoder.min.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Control.Geocoder.min.js","sources":["../src/util.js","../src/geocoders/arcgis.js","../src/geocoders/bing.js","../src/geocoders/google.js","../src/geocoders/here.js","../src/geocoders/latlng.js","../src/geocoders/mapbox.js","../src/geocoders/mapquest.js","../src/geocoders/neutrino.js","../src/geocoders/nominatim.js","../src/geocoders/open-location-code.js","../src/geocoders/opencage.js","../src/geocoders/pelias.js","../src/geocoders/photon.js","../src/geocoders/what3words.js","../src/control.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 + 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 var message;\n if (xmlHttp.status !== 200 && xmlHttp.status !== 304) {\n message = '';\n } else if (typeof xmlHttp.response === 'string') {\n // IE doesn't parse JSON responses even with responseType: 'json'.\n try {\n message = JSON.parse(xmlHttp.response);\n } catch (e) {\n // Not a JSON response\n message = xmlHttp.response;\n }\n } else {\n message = xmlHttp.response;\n }\n callback(message);\n };\n xmlHttp.open('GET', url + getParamString(params), true);\n xmlHttp.responseType = 'json';\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\nexport function getParamString(obj, existingUrl, uppercase) {\n var params = [];\n for (var i in obj) {\n var key = encodeURIComponent(uppercase ? i.toUpperCase() : i);\n var value = obj[i];\n if (!L.Util.isArray(value)) {\n params.push(key + '=' + encodeURIComponent(value));\n } else {\n for (var j = 0; j < value.length; j++) {\n params.push(key + '=' + encodeURIComponent(value[j]));\n }\n }\n }\n return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');\n}\n","import L from 'leaflet';\nimport { getJSON } from '../util';\n\nexport var ArcGis = L.Class.extend({\n options: {\n service_url: 'https://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(\n this.options.service_url + '/findAddressCandidates',\n L.extend(params, this.options.geocodingQueryParams),\n 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 Line truncated
|
||||||
@@ -6,28 +6,35 @@ I strongly believe that it is my — and your — duty to make the open
|
|||||||
|
|
||||||
While I can't force anyone to do anything, if you happen to disagree with this, I ask of you not to use any of the open source I have published. Nor am I interested in contributions from people who can't accept or act respectfully towards other humans regardless of gender identity, sexual orientation, disability, ethnicity, religion, age, physical appearance, body size, race, or similar personal characteristics. If you think feminism, anti-racism or the LGBT movement is somehow wrong, disturbing or irrelevant, I ask you to go elsewhere to find software.
|
While I can't force anyone to do anything, if you happen to disagree with this, I ask of you not to use any of the open source I have published. Nor am I interested in contributions from people who can't accept or act respectfully towards other humans regardless of gender identity, sexual orientation, disability, ethnicity, religion, age, physical appearance, body size, race, or similar personal characteristics. If you think feminism, anti-racism or the LGBT movement is somehow wrong, disturbing or irrelevant, I ask you to go elsewhere to find software.
|
||||||
|
|
||||||
Leaflet Control Geocoder [](https://www.npmjs.com/package/leaflet-control-geocoder) 
|
# Leaflet Control Geocoder [](https://www.npmjs.com/package/leaflet-control-geocoder) 
|
||||||
=============================
|
|
||||||
|
|
||||||
A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim).
|
A simple geocoder for [Leaflet](https://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:
|
The plugin supports many different data providers:
|
||||||
|
|
||||||
* [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim)
|
- LatLng to parse basic latitude/longitude strings
|
||||||
* [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
|
- [OSM](https://www.openstreetmap.org/)/[Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim)
|
||||||
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
|
- [Bing Locations API](http://msdn.microsoft.com/en-us/library/ff701715.aspx)
|
||||||
* [Mapbox Geocoding](https://www.mapbox.com/developers/api/geocoding/)
|
- [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
|
||||||
* [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
|
- [Mapbox Geocoding](https://www.mapbox.com/api-documentation/#geocoding)
|
||||||
* [What3Words](http://what3words.com/)
|
- [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
|
||||||
* [Photon](http://photon.komoot.de/)
|
- [What3Words](http://what3words.com/)
|
||||||
* [Mapzen Search](https://mapzen.com/projects/search)
|
- [Photon](http://photon.komoot.de/)
|
||||||
* [HERE Geocoder API](https://developer.here.com/documentation/geocoder/topics/introduction.html)
|
- [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:
|
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](http://perliedman.github.com/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
|
# Usage
|
||||||
|
|
||||||
@@ -42,8 +49,8 @@ Add the control to a map instance:
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var map = L.map('map').setView([0, 0], 2);
|
var map = L.map('map').setView([0, 0], 2);
|
||||||
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
L.Control.geocoder().addTo(map);
|
L.Control.geocoder().addTo(map);
|
||||||
```
|
```
|
||||||
@@ -60,7 +67,7 @@ For example:
|
|||||||
```javascript
|
```javascript
|
||||||
var geocoder = L.Control.geocoder({
|
var geocoder = L.Control.geocoder({
|
||||||
defaultMarkGeocode: false
|
defaultMarkGeocode: false
|
||||||
})
|
})
|
||||||
.on('markgeocode', function(e) {
|
.on('markgeocode', function(e) {
|
||||||
var bbox = e.geocode.bbox;
|
var bbox = e.geocode.bbox;
|
||||||
var poly = L.polygon([
|
var poly = L.polygon([
|
||||||
@@ -84,70 +91,118 @@ This is the geocoder control. It works like any other Leaflet control, and is ad
|
|||||||
|
|
||||||
### Constructor
|
### 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:
|
This plugin supports the standard JavaScript constructor (to be invoked using `new`) as well as the [class factory methods](https://leafletjs.com/reference.html#class-class-factories) known from Leaflet:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
new L.Control.Geocoder(options)
|
new L.Control.Geocoder(options);
|
||||||
// or
|
// or
|
||||||
L.Control.geocoder(options)
|
L.Control.geocoder(options);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
| Option | Type | Default | Description |
|
| Option | Type | Default | Description |
|
||||||
| ----------------- | ---------------- | ------------------- | ----------- |
|
| ------------------ | --------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
|
||||||
| `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked |
|
| `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked |
|
||||||
| `expand` | String | `"touch"` | How to expand a collapsed control: `touch` or `click` or `hover` |
|
| `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) |
|
| `position` | String | `"topright"` | Control [position](https://leafletjs.com/reference.html#control-positions) |
|
||||||
| `placeholder` | String | `"Search..."` | Placeholder text for text input
|
| `placeholder` | String | `"Search..."` | Placeholder text for text input |
|
||||||
| `errorMessage` | String | `"Nothing found."` | Message when no result found / geocoding error occurs |
|
| `errorMessage` | String | `"Nothing found."` | Message when no result found / geocoding error occurs |
|
||||||
|
| `iconLabel` | String | `"Initiate a new search"` | Accessibility label for the search icon used by screen readers |
|
||||||
| `geocoder` | IGeocoder | `new L.Control.Geocoder.Nominatim()` | Object to perform the actual geocoding queries |
|
| `geocoder` | IGeocoder | `new L.Control.Geocoder.Nominatim()` | Object to perform the actual geocoding queries |
|
||||||
|
| `showUniqueResult` | Boolean | `true` | Immediately show the unique result without prompting for alternatives |
|
||||||
| `showResultIcons` | Boolean | `false` | Show icons for geocoding results (if available); supported by Nominatim |
|
| `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) |
|
||||||
|
| `query` | String | `""` | Initial query string for text input |
|
||||||
|
| `queryMinLength` | Number | `1` | Minimum number of characters in search text before performing a query |
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
| Method | Returns | Description |
|
| Method | Returns | Description |
|
||||||
| ------------------------------------- | ------------------- | ----------------- |
|
| --------------------------------------- | ------- | --------------------------------------- |
|
||||||
| `markGeocode(<GeocodingResult> result)` | `this` | Marks a geocoding result on the map |
|
| `markGeocode(<GeocodingResult> result)` | `this` | Marks a geocoding result on the map |
|
||||||
|
| `setQuery(<String> query)` | `this` | Sets the query string on the text input |
|
||||||
|
|
||||||
## L.Control.Geocoder.Nominatim
|
## L.Control.Geocoder.Nominatim
|
||||||
|
|
||||||
Uses [Nominatim](https://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```.
|
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](https://operations.osmfoundation.org/policies/nominatim/).
|
Unless using your own Nominatim installation, please refer to the [Nominatim usage policy](https://operations.osmfoundation.org/policies/nominatim/).
|
||||||
|
|
||||||
### Constructor
|
### Constructor
|
||||||
|
|
||||||
```js
|
```js
|
||||||
new L.Control.Geocoder.Nominatim(options)
|
new L.Control.Geocoder.Nominatim(options);
|
||||||
// or
|
// or
|
||||||
L.Control.Geocoder.nominatim(options)
|
L.Control.Geocoder.nominatim(options);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options
|
### Options
|
||||||
|
|
||||||
| Option | Type | Default | Description |
|
| Option | Type | Default | Description |
|
||||||
| --------------- | ---------------- | ----------------- | ----------- |
|
| ---------------------- | -------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `serviceUrl` | String | `"https://nominatim.openstreetmap.org/"` | URL of the service |
|
| `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 |
|
| `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 |
|
| `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
|
| `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
|
## 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`.
|
||||||
|
|
||||||
Note that you need an API key to use this service.
|
Note that you need an API key to use this service.
|
||||||
|
|
||||||
### Constructor
|
### Constructor
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
new L.Control.Geocoder.Bing(<String> key)
|
new L.Control.Geocoder.Bing(<String>key);
|
||||||
// or
|
// or
|
||||||
L.Control.Geocoder.bing(<String> key)
|
L.Control.Geocoder.bing(<String>key);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## L.Control.Geocoder.OpenCage
|
||||||
|
|
||||||
|
Uses [OpenCage Data API](https://opencagedata.com/) to respond to geocoding queries. Implements `IGeocoder`.
|
||||||
|
|
||||||
|
Note that you need an API key to use this service.
|
||||||
|
|
||||||
|
### Constructor
|
||||||
|
|
||||||
|
```ts
|
||||||
|
new L.Control.Geocoder.OpenCage(<String>key, options);
|
||||||
|
// or
|
||||||
|
L.Control.Geocoder.opencage(<String>key, options);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
| Option | Type | Default | Description |
|
||||||
|
| ---------------------- | ------ | ------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||||
|
| `serviceUrl` | String | `"https://api.opencagedata.com/geocode/v1/json"` | URL of the service |
|
||||||
|
| `geocodingQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to geocoding requests |
|
||||||
|
| `reverseQueryParams` | Object | `{}` | Additional URL parameters (strings) that will be added to reverse geocoding requests |
|
||||||
|
|
||||||
|
## L.Control.Geocoder.LatLng
|
||||||
|
|
||||||
|
Parses basic latitude/longitude strings such as `'50.06773 14.37742'`, `'N50.06773 W14.37742'`, `'S 50° 04.064 E 014° 22.645'`, or `'S 50° 4′ 03.828″, W 14° 22′ 38.712″'`.
|
||||||
|
|
||||||
|
### Constructor
|
||||||
|
|
||||||
|
```ts
|
||||||
|
new L.Control.Geocoder.LatLng(options);
|
||||||
|
// or
|
||||||
|
L.Control.Geocoder.latLng(options);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
| 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`. |
|
||||||
|
|
||||||
## IGeocoder
|
## IGeocoder
|
||||||
|
|
||||||
An interface implemented to respond to geocoding queries.
|
An interface implemented to respond to geocoding queries.
|
||||||
@@ -155,8 +210,9 @@ An interface implemented to respond to geocoding queries.
|
|||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
| Method | Returns | Description |
|
| Method | Returns | Description |
|
||||||
| ------------------------------------- | ------------------- | ----------------- |
|
| ----------------------------------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `geocode(<String> query, callback, context)` | `GeocodingResult[]` | Performs a geocoding query and returns the results to the callback in the provided context |
|
| `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 |
|
| `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 |
|
||||||
|
|
||||||
## GeocodingResult
|
## GeocodingResult
|
||||||
@@ -166,7 +222,7 @@ An object that represents a result from a geocoding query.
|
|||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| ------------ | ---------------- | ------------------------------------- |
|
| -------- | -------------- | ---------------------------------------------------- |
|
||||||
| `name` | String | Name of found location |
|
| `name` | String | Name of found location |
|
||||||
| `bbox` | L.LatLngBounds | The bounds of the location |
|
| `bbox` | L.LatLngBounds | The bounds of the location |
|
||||||
| `center` | L.LatLng | The center coordinate of the location |
|
| `center` | L.LatLng | The center coordinate of the location |
|
||||||
|
|||||||
@@ -1,40 +1,63 @@
|
|||||||
{
|
{
|
||||||
"name": "leaflet-control-geocoder",
|
"name": "leaflet-control-geocoder",
|
||||||
"version": "1.6.0",
|
"version": "1.13.0",
|
||||||
"description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest, Mapzen, HERE",
|
"description": "Extendable geocoder with builtin support for OpenStreetMap Nominatim, Bing, Google, Mapbox, MapQuest, What3Words, Photon, Pelias, HERE, Neutrino, Plus codes",
|
||||||
"main": "dist/Control.Geocoder.js",
|
"main": "dist/Control.Geocoder.js",
|
||||||
|
"module": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "npm run build",
|
"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 --output.format=iife --name=L.Control.Geocoder --globals=leaflet:L src/index.js --output.file=dist/Control.Geocoder.js --sourcemap",
|
"build:js": "rollup -c",
|
||||||
"build:css": "cpr Control.Geocoder.css dist/ --overwrite",
|
"build:css": "cpr Control.Geocoder.css dist/Control.Geocoder.css --overwrite",
|
||||||
"build:img": "cpr images/ dist/images/ --overwrite",
|
"build:img": "cpr images/ dist/images/ --overwrite",
|
||||||
"test": "npm run lint",
|
"build:demo-rollup": "cd demo-rollup && npm install && npm run build",
|
||||||
"lint": "npm run lint:js && npm run lint:css",
|
"build:demo-webpack": "cd demo-rollup && npm install && npm run build",
|
||||||
"lint:js": "eslint 'src/**'",
|
"test": "npm run test:karma -- --single-run && npm run lint",
|
||||||
"lint:css": "prettier --list-different '*.css'",
|
"test:karma": "karma start spec/karma.conf.js",
|
||||||
"publish": "sh ./scripts/publish.sh",
|
"lint": "npm run lint:js && npm run lint:style",
|
||||||
"postpublish": "sh ./scripts/postpublish.sh"
|
"lint:js": "eslint .",
|
||||||
|
"lint:style": "prettier --check $(npm run ls-files)",
|
||||||
|
"fix:style": "prettier --write $(npm run ls-files)",
|
||||||
|
"ls-files": "git ls-files '*.js' '*.json' '*.css' '*.html' '*.yaml' '*.yml' '*.md'"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/perliedman/leaflet-control-geocoder.git"
|
"url": "git://github.com/perliedman/leaflet-control-geocoder.git"
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENCE",
|
||||||
|
"dist/**",
|
||||||
|
"demo/**",
|
||||||
|
"images/**",
|
||||||
|
"src/**",
|
||||||
|
"*.css"
|
||||||
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"leaflet",
|
"leaflet",
|
||||||
"geocoder",
|
"geocoder",
|
||||||
"locations",
|
"locations",
|
||||||
|
"openstreetmap",
|
||||||
"nominatim",
|
"nominatim",
|
||||||
"bing",
|
"bing",
|
||||||
"google",
|
"bingmaps",
|
||||||
|
"googlemaps",
|
||||||
|
"google-maps",
|
||||||
"mapbox",
|
"mapbox",
|
||||||
"photon",
|
|
||||||
"what3words",
|
|
||||||
"mapquest",
|
"mapquest",
|
||||||
|
"opencage",
|
||||||
|
"what3words",
|
||||||
|
"photon",
|
||||||
"mapzen",
|
"mapzen",
|
||||||
"here"
|
"pelias",
|
||||||
|
"here",
|
||||||
|
"neutrino",
|
||||||
|
"pluscodes",
|
||||||
|
"open location code"
|
||||||
],
|
],
|
||||||
"author": "Per Liedman <per@liedman.net>",
|
"author": "Per Liedman <per@liedman.net>",
|
||||||
|
"contributors": [
|
||||||
|
"Simon Legner <Simon.Legner@gmail.com>"
|
||||||
|
],
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/perliedman/leaflet-control-geocoder/issues"
|
"url": "https://github.com/perliedman/leaflet-control-geocoder/issues"
|
||||||
@@ -42,9 +65,23 @@
|
|||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cpr": "^3.0.1",
|
"cpr": "^3.0.1",
|
||||||
"eslint": "^4.15.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-prettier": "^2.4.0",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"prettier": "^1.9.2",
|
"karma": "^4.4.1",
|
||||||
"rollup": "^0.53.2"
|
"karma-expect": "^1.1.3",
|
||||||
|
"karma-mocha": "^1.3.0",
|
||||||
|
"karma-phantomjs-launcher": "^1.0.4",
|
||||||
|
"karma-sinon": "^1.0.5",
|
||||||
|
"leaflet": "^1.6.0",
|
||||||
|
"mocha": "^6.2.2",
|
||||||
|
"phantomjs-prebuilt": "^2.1.16",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
|
"rollup": "^0.65.2",
|
||||||
|
"rollup-plugin-uglify": "^5.0.2",
|
||||||
|
"sinon": "^7.5.0",
|
||||||
|
"uglify-js": "^3.7.5"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"open-location-code": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ $GLOBALS['LEAFLET_LIBRARIES']['leaflet-fullscreen'] = array
|
|||||||
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array
|
$GLOBALS['LEAFLET_LIBRARIES']['leaflet-control-geocoder'] = array
|
||||||
(
|
(
|
||||||
'name' => 'Leaflet Control Geocoder',
|
'name' => 'Leaflet Control Geocoder',
|
||||||
'version' => '1.6.0',
|
'version' => '1.13.0',
|
||||||
'license' => '<a href="https://github.com/perliedman/leaflet-control-geocoder/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>',
|
'license' => '<a href="https://github.com/perliedman/leaflet-control-geocoder/blob/master/LICENSE" target="_blank">BSD-2-Clause</a>',
|
||||||
'homepage' => 'https://github.com/perliedman/leaflet-control-geocoder',
|
'homepage' => 'https://github.com/perliedman/leaflet-control-geocoder',
|
||||||
'css' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css',
|
'css' => 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css',
|
||||||
|
|||||||
Reference in new issue
Block a user