forked from Snck3rs/contao-leaflet-libraries
Update leaflet-control-geocoder to v1.5.4.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.leafletControlGeocoder = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Nominatim = require('./geocoders/nominatim')["class"];
|
Nominatim = _dereq_('./geocoders/nominatim')["class"];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Control.extend({
|
"class": L.Control.extend({
|
||||||
@@ -51,12 +51,14 @@ module.exports = {
|
|||||||
this._alts = L.DomUtil.create('ul',
|
this._alts = L.DomUtil.create('ul',
|
||||||
className + '-alternatives leaflet-control-geocoder-alternatives-minimized',
|
className + '-alternatives leaflet-control-geocoder-alternatives-minimized',
|
||||||
container);
|
container);
|
||||||
|
L.DomEvent.disableClickPropagation(this._alts);
|
||||||
|
|
||||||
L.DomEvent.addListener(input, 'keydown', this._keydown, this);
|
L.DomEvent.addListener(input, 'keydown', this._keydown, this);
|
||||||
L.DomEvent.addListener(input, 'blur', function() {
|
L.DomEvent.addListener(input, 'blur', function() {
|
||||||
if (this.options.collapsed) {
|
if (this.options.collapsed && !this._preventBlurCollapse) {
|
||||||
this._collapse();
|
this._collapse();
|
||||||
}
|
}
|
||||||
|
this._preventBlurCollapse = false;
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
||||||
@@ -147,9 +149,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_geocodeResultSelected: function(result) {
|
_geocodeResultSelected: function(result) {
|
||||||
if (this.options.collapsed) {
|
if (!this.options.collapsed) {
|
||||||
this._collapse();
|
|
||||||
} else {
|
|
||||||
this._clearResults();
|
this._clearResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,9 +188,20 @@ module.exports = {
|
|||||||
a = L.DomUtil.create('a', '', li),
|
a = L.DomUtil.create('a', '', li),
|
||||||
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null,
|
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null,
|
||||||
text = result.html ? undefined : document.createTextNode(result.name),
|
text = result.html ? undefined : document.createTextNode(result.name),
|
||||||
clickHandler = function clickHandler(e) {
|
mouseDownHandler = function mouseDownHandler(e) {
|
||||||
L.DomEvent.preventDefault(e);
|
// In some browsers, a click will fire on the map if the control is
|
||||||
|
// collapsed directly after mousedown. To work around this, we
|
||||||
|
// wait until the click is completed, and _then_ collapse the
|
||||||
|
// control. Messy, but this is the workaround I could come up with
|
||||||
|
// for #142.
|
||||||
|
this._preventBlurCollapse = true;
|
||||||
|
L.DomEvent.stop(e);
|
||||||
this._geocodeResultSelected(result);
|
this._geocodeResultSelected(result);
|
||||||
|
L.DomEvent.on(li, 'click', function() {
|
||||||
|
if (this.options.collapsed) {
|
||||||
|
this._collapse();
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
@@ -205,7 +216,10 @@ module.exports = {
|
|||||||
a.appendChild(text);
|
a.appendChild(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
L.DomEvent.addListener(li, 'mousedown', clickHandler, this);
|
// Use mousedown and not click, since click will fire _after_ blur,
|
||||||
|
// causing the control to have collapsed and removed the items
|
||||||
|
// before the click can fire.
|
||||||
|
L.DomEvent.addListener(li, 'mousedown', mouseDownHandler, this);
|
||||||
|
|
||||||
return li;
|
return li;
|
||||||
},
|
},
|
||||||
@@ -275,10 +289,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"./geocoders/nominatim":9}],2:[function(require,module,exports){
|
},{"./geocoders/nominatim":9}],2:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -362,10 +376,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],3:[function(require,module,exports){
|
},{"../util":13}],3:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -419,10 +433,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],4:[function(require,module,exports){
|
},{"../util":13}],4:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -512,10 +526,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],5:[function(require,module,exports){
|
},{"../util":13}],5:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -586,10 +600,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],6:[function(require,module,exports){
|
},{"../util":13}],6:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -678,10 +692,10 @@ module.exports = {
|
|||||||
|
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],7:[function(require,module,exports){
|
},{"../util":13}],7:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -767,10 +781,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],8:[function(require,module,exports){
|
},{"../util":13}],8:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -856,10 +870,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],9:[function(require,module,exports){
|
},{"../util":13}],9:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -954,10 +968,10 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],10:[function(require,module,exports){
|
},{"../util":13}],10:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -1057,10 +1071,10 @@ module.exports = {
|
|||||||
|
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],11:[function(require,module,exports){
|
},{"../util":13}],11:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Util = require('../util');
|
Util = _dereq_('../util');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"class": L.Class.extend({
|
"class": L.Class.extend({
|
||||||
@@ -1123,20 +1137,20 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"../util":13}],12:[function(require,module,exports){
|
},{"../util":13}],12:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
Control = require('./control'),
|
Control = _dereq_('./control'),
|
||||||
Nominatim = require('./geocoders/nominatim'),
|
Nominatim = _dereq_('./geocoders/nominatim'),
|
||||||
Bing = require('./geocoders/bing'),
|
Bing = _dereq_('./geocoders/bing'),
|
||||||
MapQuest = require('./geocoders/mapquest'),
|
MapQuest = _dereq_('./geocoders/mapquest'),
|
||||||
Mapbox = require('./geocoders/mapbox'),
|
Mapbox = _dereq_('./geocoders/mapbox'),
|
||||||
What3Words = require('./geocoders/what3words'),
|
What3Words = _dereq_('./geocoders/what3words'),
|
||||||
Google = require('./geocoders/google'),
|
Google = _dereq_('./geocoders/google'),
|
||||||
Photon = require('./geocoders/photon'),
|
Photon = _dereq_('./geocoders/photon'),
|
||||||
Mapzen = require('./geocoders/mapzen'),
|
Mapzen = _dereq_('./geocoders/mapzen'),
|
||||||
ArcGis = require('./geocoders/arcgis'),
|
ArcGis = _dereq_('./geocoders/arcgis'),
|
||||||
HERE = require('./geocoders/here');
|
HERE = _dereq_('./geocoders/here');
|
||||||
|
|
||||||
module.exports = L.Util.extend(Control["class"], {
|
module.exports = L.Util.extend(Control["class"], {
|
||||||
Nominatim: Nominatim["class"],
|
Nominatim: Nominatim["class"],
|
||||||
@@ -1167,7 +1181,7 @@ L.Util.extend(L.Control, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{"./control":1,"./geocoders/arcgis":2,"./geocoders/bing":3,"./geocoders/google":4,"./geocoders/here":5,"./geocoders/mapbox":6,"./geocoders/mapquest":7,"./geocoders/mapzen":8,"./geocoders/nominatim":9,"./geocoders/photon":10,"./geocoders/what3words":11}],13:[function(require,module,exports){
|
},{"./control":1,"./geocoders/arcgis":2,"./geocoders/bing":3,"./geocoders/google":4,"./geocoders/here":5,"./geocoders/mapbox":6,"./geocoders/mapquest":7,"./geocoders/mapzen":8,"./geocoders/nominatim":9,"./geocoders/photon":10,"./geocoders/what3words":11}],13:[function(_dereq_,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null),
|
||||||
lastCallbackId = 0,
|
lastCallbackId = 0,
|
||||||
@@ -1253,4 +1267,5 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||||
},{}]},{},[12]);
|
},{}]},{},[12])(12)
|
||||||
|
});
|
||||||
File diff suppressed because one or more lines are too long
46
assets/control-geocoder/README.md
Normal file → Executable file
46
assets/control-geocoder/README.md
Normal file → Executable file
@@ -6,7 +6,7 @@ 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 [](http://badge.fury.io/js/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](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim).
|
A simple geocoder for [Leaflet](http://leafletjs.com/) that by default uses [OSM](http://www.openstreetmap.org/)/[Nominatim](http://wiki.openstreetmap.org/wiki/Nominatim).
|
||||||
@@ -18,18 +18,24 @@ The plugin supports many different data providers:
|
|||||||
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
|
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
|
||||||
* [Mapbox Geocoding](https://www.mapbox.com/developers/api/geocoding/)
|
* [Mapbox Geocoding](https://www.mapbox.com/developers/api/geocoding/)
|
||||||
* [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
|
* [MapQuest Geocoding API](http://developer.mapquest.com/web/products/dev-services/geocoding-ws)
|
||||||
* [RaveGeo](http://www2.idevio.com/ravegeo-server.html)
|
* [What3Words](http://what3words.com/)
|
||||||
|
* [Photon](http://photon.komoot.de/)
|
||||||
|
* [Mapzen Search](https://mapzen.com/projects/search)
|
||||||
|
* [HERE Geocoder API] (https://developer.here.com/rest-apis/documentation/geocoder/topics/overview.html)
|
||||||
|
|
||||||
The plugin can easily be extended to support other providers.
|
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)
|
||||||
|
|
||||||
See the [Leaflet Control Geocoder Demo](http://perliedman.github.com/leaflet-control-geocoder/).
|
See the [Leaflet Control Geocoder Demo](http://perliedman.github.com/leaflet-control-geocoder/).
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Load the CSS and Javascript:
|
[Download latest release](https://github.com/perliedman/leaflet-control-geocoder/releases). Load the CSS and Javascript, located in
|
||||||
|
the `dist` folder:
|
||||||
|
|
||||||
```HTML
|
```HTML
|
||||||
<link rel="stylesheet" href="../Control.Geocoder.css" />
|
<link rel="stylesheet" href="Control.Geocoder.css" />
|
||||||
<script src="Control.Geocoder.js"></script>
|
<script src="Control.Geocoder.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -46,23 +52,27 @@ L.Control.geocoder().addTo(map);
|
|||||||
# Customizing
|
# Customizing
|
||||||
|
|
||||||
By default, when a geocoding result is found, the control will center the map on it and place
|
By default, when a geocoding result is found, the control will center the map on it and place
|
||||||
a marker at its location. This can be customized by overwriting the control's ```markGeocode```
|
a marker at its location. This can be customized by listening to the control's `markgeocode`
|
||||||
function, to perform any action desired.
|
event. To remove the control's default handler for marking a result, set the option
|
||||||
|
`defaultMarkGeocode` to `false`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var geocoder = L.Control.geocoder().addTo(map);
|
var geocoder = L.Control.geocoder({
|
||||||
|
defaultMarkGeocode: false
|
||||||
geocoder.markGeocode = function(result) {
|
})
|
||||||
var bbox = result.bbox;
|
.on('markgeocode', function(e) {
|
||||||
L.polygon([
|
var bbox = e.geocode.bbox;
|
||||||
bbox.getSouthEast(),
|
var poly = L.polygon([
|
||||||
bbox.getNorthEast(),
|
bbox.getSouthEast(),
|
||||||
bbox.getNorthWest(),
|
bbox.getNorthEast(),
|
||||||
bbox.getSouthWest()
|
bbox.getNorthWest(),
|
||||||
]).addTo(map);
|
bbox.getSouthWest()
|
||||||
};
|
]).addTo(map);
|
||||||
|
map.fitBounds(poly.getBounds());
|
||||||
|
})
|
||||||
|
.addTo(map);
|
||||||
```
|
```
|
||||||
|
|
||||||
This will add a polygon representing the result's boundingbox when a result is selected.
|
This will add a polygon representing the result's boundingbox when a result is selected.
|
||||||
|
|||||||
25
assets/control-geocoder/bower.json
Normal file → Executable file
25
assets/control-geocoder/bower.json
Normal file → Executable file
@@ -1,12 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "leaflet-control-geocoder",
|
"name": "leaflet-control-geocoder",
|
||||||
"version": "1.1.0",
|
"version": "1.5.4",
|
||||||
"homepage": "https://github.com/perliedman/leaflet-control-geocoder",
|
"homepage": "https://github.com/perliedman/leaflet-control-geocoder",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Per Liedman <per@liedman.net>"
|
"Per Liedman <per@liedman.net>"
|
||||||
],
|
],
|
||||||
"description": "Extendable geocoder with builtin OSM/Nominatim support",
|
"description": "Extendable geocoder with builtin OSM/Nominatim support",
|
||||||
"main": "Control.Geocoder.js",
|
"main": [
|
||||||
|
"Control.Geocoder.js",
|
||||||
|
"Control.Geocoder.css",
|
||||||
|
"images/geocoder.png",
|
||||||
|
"images/throbber.gif"
|
||||||
|
],
|
||||||
"moduleType": [
|
"moduleType": [
|
||||||
"amd",
|
"amd",
|
||||||
"globals"
|
"globals"
|
||||||
@@ -14,7 +19,16 @@
|
|||||||
"keywords": [
|
"keywords": [
|
||||||
"leaflet",
|
"leaflet",
|
||||||
"geocoder",
|
"geocoder",
|
||||||
"nominatim"
|
"locations",
|
||||||
|
"nominatim",
|
||||||
|
"bing",
|
||||||
|
"google",
|
||||||
|
"mapbox",
|
||||||
|
"photon",
|
||||||
|
"what3words",
|
||||||
|
"mapquest",
|
||||||
|
"mapzen",
|
||||||
|
"here"
|
||||||
],
|
],
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
@@ -23,8 +37,5 @@
|
|||||||
"bower_components",
|
"bower_components",
|
||||||
"test",
|
"test",
|
||||||
"tests"
|
"tests"
|
||||||
],
|
]
|
||||||
"dependencies": {
|
|
||||||
"leaflet": "~0.7.2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "leaflet-control-geocoder",
|
"name": "leaflet-control-geocoder",
|
||||||
"version": "1.1.0",
|
"version": "1.5.4",
|
||||||
"description": "Extendable geocoder with builtin OSM/Nominatim support",
|
"description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest, Mapzen, HERE",
|
||||||
"main": "Control.Geocoder.js",
|
"main": "dist/Control.Geocoder.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"prepublish": "sh ./scripts/build.sh",
|
||||||
|
"publish": "sh ./scripts/publish.sh",
|
||||||
|
"postpublish": "sh ./scripts/postpublish.sh"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -13,14 +15,30 @@
|
|||||||
"keywords": [
|
"keywords": [
|
||||||
"leaflet",
|
"leaflet",
|
||||||
"geocoder",
|
"geocoder",
|
||||||
"nominatim"
|
"locations",
|
||||||
|
"nominatim",
|
||||||
|
"bing",
|
||||||
|
"google",
|
||||||
|
"mapbox",
|
||||||
|
"photon",
|
||||||
|
"what3words",
|
||||||
|
"mapquest",
|
||||||
|
"mapzen",
|
||||||
|
"here"
|
||||||
],
|
],
|
||||||
"author": "Per Liedman <per@liedman.net>",
|
"author": "Per Liedman <per@liedman.net>",
|
||||||
"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"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"browserify-shim": {
|
||||||
"leaflet": "~0.7.2"
|
"leaflet": "global:L"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"browserify": "^11.0.1",
|
||||||
|
"browserify-shim": "^3.8.10",
|
||||||
|
"derequire": "^2.0.3",
|
||||||
|
"es3ify": "^0.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.5.1',
|
'version' => '1.5.4',
|
||||||
'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