pointsight/static/js/leaflet-search/leaflet-search.js.map

1 line
39 KiB
Plaintext
Raw Normal View History

2022-03-06 18:36:36 +01:00
{"version":3,"file":"leaflet-search.js","sources":["../src/geo.js","../src/providers/nominatim.js","../src/providers/geonames.js","../src/providers/here.js","../src/providers/tomtom.js","../src/providers/kadaster.js","../node_modules/lodash.debounce/index.js","../src/index.js"],"sourcesContent":["/**\r\n * sjaakp/leaflet-search\r\n * ----------\r\n * Search Control for Leaflet\r\n * Version 1.0.0\r\n * Copyright (c) 2020\r\n * Sjaak Priester, Amsterdam\r\n * MIT License\r\n * https://github.com/sjaakp/leaflet-search\r\n * https://sjaakpriester.nl\r\n */\r\n\r\nL.geo = {\r\n Geocoder: L.Class.extend({\r\n initialize: function (map, options) {\r\n this._map = map;\r\n L.setOptions(this, options);\r\n },\r\n\r\n constructUrl(text, options = {}) {\r\n const opts = Object.assign({}, this.options, options),\r\n url = new URL(text);\r\n for (const k in opts) {\r\n url.searchParams.set(k, opts[k]);\r\n }\r\n return url;\r\n },\r\n\r\n fetchJson(url) {\r\n return fetch(url.href)\r\n .then(response => response.json())\r\n },\r\n\r\n placeMarker(latlng, bbox, place) {\r\n this._map.placeMarker(latlng, bbox, place);\r\n },\r\n\r\n fire(err) {\r\n this._map.fire(err);\r\n },\r\n\r\n suggest(address, datalist) {\r\n },\r\n\r\n lookup(id) {\r\n }\r\n })\r\n};\r\n","\r\n/**\r\n * sjaakp/leaflet-search\r\n * ----------\r\n * Search Control for Leaflet\r\n * Version 1.0.0\r\n * Copyright (c) 2020\r\n * Sjaak Priester, Amsterdam\r\n * MIT License\r\n * https://github.com/sjaakp/leaflet-search\r\n * https://sjaakpriester.nl\r\n */\r\n\r\n/**\r\n * @link https://nominatim.org/release-docs/develop/api/Search/\r\n */\r\nL.geo.Nominatim = L.geo.Geocoder.extend({\r\n url: 'https://nominatim.openstreetmap.org/',\r\n\r\n mark(place) {\r\n const latlng = L.latLng(place.lat, place.lon),\r\n bb = place.boundingbox,\r\n bbox = L.latLngBounds([bb[0], bb[2]], [bb[1], bb[3]]);\r\n this.placeMarker(latlng, bbox, place);\r\n },\r\n\r\n search(address) {\r\n const url = this.constructUrl(this.url + 'search', { format: 'json', q: address });\r\n return this.fetchJson(url)\r\n },\r\n\r\n suggest(address, datalist) {\r\n // const url = this.constructUrl(this.url + 'search', { format: 'json', q: address });\r\n this.search(address)\r\n .then(json => {\r\n // console.log(json);\r\n datalist.innerHTML = json.reduce((a, v) => a + `<option data-id=\"${v.osm_type.charAt(0).toUpperCase()}${v.osm_id}\">${v.display_name}</option>`, '');\r\n })\r\n .catch(error => this.fire(error));\r\n },\r\n\r\n lookup(id) {\r\n const url = this.constructUrl(this.url + 'reverse', {\r\n format: 'json',\r\n osm_type: id.charAt(0),\r\n osm_id: id.slice(1)\r\n });\r\n this.fetchJson(url)\r\n .then(json => this.mark(json))\r\n .catch(error => this.fire(error));\r\n },\r\n\r\n geocode(address) {\r\n // fetch('//nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(address))\r\n // .then(response => response.json())\r\n this.search(address)\r\n .then(json => {\r\n if (json.length < 1) throw('notfound');\r\n return json[0];\r\n })\r\n .then(place => this.mark(place))\r\n .catch(error => this.fire(error));\r\n }\r\n});\r\n","/**\r\n * sjaakp/leaflet-search\r\n * ----------\r\n * Search Control for Leaflet\r\n * Version 1.0.0\r\n * Copyright (c) 2020\r\n * Sjaak Priester, Amsterdam\r\n * MIT License\r\n * https://github.com/sjaakp/leaflet-search\r\n * https://sjaakpriester.nl\r\n */\r\n\r\n/**\r\n * Topological names only; no streets\r\n * @link http://www.geonames.org/export/geonames-