leaflet-control-geocoder
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "leaflet-control-geocoder", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"homepage": "https://github.com/perliedman/leaflet-control-geocoder", | ||
@@ -10,5 +10,7 @@ "authors": [ | ||
"main": [ | ||
"Control.Geocoder.js", | ||
"Control.Geocoder.css" | ||
], | ||
"Control.Geocoder.js", | ||
"Control.Geocoder.css", | ||
"images/geocoder.png", | ||
"images/throbber.gif" | ||
], | ||
"moduleType": [ | ||
@@ -28,3 +30,4 @@ "amd", | ||
"what3words", | ||
"mapquest" | ||
"mapquest", | ||
"mapzen" | ||
], | ||
@@ -31,0 +34,0 @@ "license": "BSD-2-Clause", |
(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 (global){ | ||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
Nominatim = require('./geocoders/nominatim').class; | ||
Nominatim = require('./geocoders/nominatim')["class"]; | ||
module.exports = { | ||
class: L.Control.extend({ | ||
"class": L.Control.extend({ | ||
options: { | ||
@@ -235,3 +235,3 @@ showResultIcons: false, | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./geocoders/nominatim":6}],2:[function(require,module,exports){ | ||
},{"./geocoders/nominatim":7}],2:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -242,3 +242,3 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
module.exports = { | ||
class: L.Class.extend({ | ||
"class": L.Class.extend({ | ||
initialize: function(key) { | ||
@@ -294,3 +294,3 @@ this.key = key; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":10}],3:[function(require,module,exports){ | ||
},{"../util":11}],3:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -301,3 +301,3 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
module.exports = { | ||
class: L.Class.extend({ | ||
"class": L.Class.extend({ | ||
options: { | ||
@@ -318,3 +318,3 @@ serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json', | ||
var params = { | ||
address: query, | ||
address: query | ||
}; | ||
@@ -390,3 +390,3 @@ | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":10}],4:[function(require,module,exports){ | ||
},{"../util":11}],4:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -397,3 +397,3 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
module.exports = { | ||
class: L.Class.extend({ | ||
"class": L.Class.extend({ | ||
options: { | ||
@@ -410,3 +410,3 @@ serviceUrl: 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places-v1/' | ||
Util.getJSON(this.options.serviceUrl + encodeURIComponent(query) + '.json', { | ||
access_token: this._accessToken, | ||
access_token: this._accessToken | ||
}, function(data) { | ||
@@ -447,3 +447,3 @@ var results = [], | ||
Util.getJSON(this.options.serviceUrl + encodeURIComponent(location.lng) + ',' + encodeURIComponent(location.lat) + '.json', { | ||
access_token: this._accessToken, | ||
access_token: this._accessToken | ||
}, function(data) { | ||
@@ -486,3 +486,3 @@ var results = [], | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":10}],5:[function(require,module,exports){ | ||
},{"../util":11}],5:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -493,3 +493,3 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
module.exports = { | ||
class: L.Class.extend({ | ||
"class": L.Class.extend({ | ||
options: { | ||
@@ -577,3 +577,3 @@ serviceUrl: '//www.mapquestapi.com/geocoding/v1' | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":10}],6:[function(require,module,exports){ | ||
},{"../util":11}],6:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -584,4 +584,82 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
module.exports = { | ||
class: L.Class.extend({ | ||
"class": L.Class.extend({ | ||
options: { | ||
serviceUrl: '//search.mapzen.com/v1', | ||
geocodingQueryParams: {}, | ||
reverseQueryParams: {} | ||
}, | ||
initialize: function(apiKey, options) { | ||
L.Util.setOptions(this, options); | ||
this._apiKey = apiKey; | ||
this._lastSuggest = 0; | ||
}, | ||
geocode: function(query, cb, context) { | ||
var _this = this; | ||
Util.getJSON(this.options.serviceUrl + "/search", L.extend({ | ||
'api_key': this._apiKey, | ||
'text': query | ||
}, this.options.geocodingQueryParams), function(data) { | ||
cb.call(context, _this._parseResults(data, "bbox")); | ||
}); | ||
}, | ||
suggest: function(query, cb, context) { | ||
var _this = this; | ||
Util.getJSON(this.options.serviceUrl + "/autocomplete", L.extend({ | ||
'api_key': this._apiKey, | ||
'text': query | ||
}, this.options.geocodingQueryParams), function(data) { | ||
if (data.geocoding.timestamp > this._lastSuggest) { | ||
this._lastSuggest = data.geocoding.timestamp; | ||
cb.call(context, _this._parseResults(data, "bbox")); | ||
} | ||
}); | ||
}, | ||
reverse: function(location, scale, cb, context) { | ||
var _this = this; | ||
Util.getJSON(this.options.serviceUrl + "/reverse", L.extend({ | ||
'api_key': this._apiKey, | ||
'point.lat': location.lat, | ||
'point.lon': location.lng | ||
}, this.options.reverseQueryParams), function(data) { | ||
cb.call(context, _this._parseResults(data, "bounds")); | ||
}); | ||
}, | ||
_parseResults: function(data, bboxname) { | ||
var results = []; | ||
L.geoJson(data, { | ||
pointToLayer: function (feature, latlng) { | ||
return L.circleMarker(latlng); | ||
}, | ||
onEachFeature: function(feature, layer) { | ||
var result = {}; | ||
result['name'] = layer.feature.properties.label; | ||
result[bboxname] = layer.getBounds(); | ||
result['center'] = result[bboxname].getCenter(); | ||
result['properties'] = layer.feature.properties; | ||
results.push(result); | ||
} | ||
}); | ||
return results; | ||
} | ||
}), | ||
factory: function(apiKey, options) { | ||
return new L.Control.Geocoder.Mapzen(apiKey, options); | ||
} | ||
}; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":11}],7:[function(require,module,exports){ | ||
(function (global){ | ||
var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
Util = require('../util'); | ||
module.exports = { | ||
"class": L.Class.extend({ | ||
options: { | ||
serviceUrl: '//nominatim.openstreetmap.org/', | ||
@@ -616,3 +694,3 @@ geocodingQueryParams: {}, | ||
geocode: function(query, cb, context) { | ||
Util.jsonp(this.options.serviceUrl + 'search/', L.extend({ | ||
Util.jsonp(this.options.serviceUrl + 'search', L.extend({ | ||
q: query, | ||
@@ -644,3 +722,3 @@ limit: 5, | ||
reverse: function(location, scale, cb, context) { | ||
Util.jsonp(this.options.serviceUrl + 'reverse/', L.extend({ | ||
Util.jsonp(this.options.serviceUrl + 'reverse', L.extend({ | ||
lat: location.lat, | ||
@@ -679,3 +757,3 @@ lon: location.lng, | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":10}],7:[function(require,module,exports){ | ||
},{"../util":11}],8:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -686,3 +764,3 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
module.exports = { | ||
class: L.Class.extend({ | ||
"class": L.Class.extend({ | ||
options: { | ||
@@ -709,3 +787,3 @@ serviceUrl: '//photon.komoot.de/api/', | ||
var params = L.extend({ | ||
q: query, | ||
q: query | ||
}, this.options.geocodingQueryParams); | ||
@@ -785,3 +863,3 @@ | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":10}],8:[function(require,module,exports){ | ||
},{"../util":11}],9:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -792,3 +870,3 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
module.exports = { | ||
class: L.Class.extend({ | ||
"class": L.Class.extend({ | ||
options: { | ||
@@ -806,3 +884,3 @@ serviceUrl: 'http://api.what3words.com/' | ||
key: this._accessToken, | ||
string: query.split(/\s+/).join('.'), | ||
string: query.split(/\s+/).join('.') | ||
}, function(data) { | ||
@@ -856,3 +934,3 @@ var results = [], loc, latLng, latLngBounds; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"../util":10}],9:[function(require,module,exports){ | ||
},{"../util":11}],10:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -867,19 +945,22 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
Google = require('./geocoders/google'), | ||
Photon = require('./geocoders/photon'); | ||
Photon = require('./geocoders/photon'), | ||
Mapzen = require('./geocoders/mapzen'); | ||
module.exports = L.Util.extend(Control.class, { | ||
Nominatim: Nominatim.class, | ||
module.exports = L.Util.extend(Control["class"], { | ||
Nominatim: Nominatim["class"], | ||
nominatim: Nominatim.factory, | ||
Bing: Bing.class, | ||
Bing: Bing["class"], | ||
bing: Bing.factory, | ||
MapQuest: MapQuest.class, | ||
MapQuest: MapQuest["class"], | ||
mapQuest: MapQuest.factory, | ||
Mapbox: Mapbox.class, | ||
Mapbox: Mapbox["class"], | ||
mapbox: Mapbox.factory, | ||
What3Words: What3Words.class, | ||
What3Words: What3Words["class"], | ||
what3words: What3Words.factory, | ||
Google: Google.class, | ||
Google: Google["class"], | ||
google: Google.factory, | ||
Photon: Photon.class, | ||
photon: Photon.factory | ||
Photon: Photon["class"], | ||
photon: Photon.factory, | ||
Mapzen: Mapzen["class"], | ||
mapzen: Mapzen.factory | ||
}); | ||
@@ -893,3 +974,3 @@ | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./control":1,"./geocoders/bing":2,"./geocoders/google":3,"./geocoders/mapbox":4,"./geocoders/mapquest":5,"./geocoders/nominatim":6,"./geocoders/photon":7,"./geocoders/what3words":8}],10:[function(require,module,exports){ | ||
},{"./control":1,"./geocoders/bing":2,"./geocoders/google":3,"./geocoders/mapbox":4,"./geocoders/mapquest":5,"./geocoders/mapzen":6,"./geocoders/nominatim":7,"./geocoders/photon":8,"./geocoders/what3words":9}],11:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -980,2 +1061,2 @@ var L = (typeof window !== "undefined" ? window['L'] : typeof global !== "undefined" ? global['L'] : null), | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}]},{},[9]); | ||
},{}]},{},[10]); |
{ | ||
"name": "leaflet-control-geocoder", | ||
"version": "1.3.1", | ||
"description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest", | ||
"version": "1.3.2", | ||
"description": "Extendable geocoder with builtin support for Nominatim, Bing, Google, Mapbox, Photon, What3Words, MapQuest, Mapzen", | ||
"main": "src/index.js", | ||
@@ -24,3 +24,4 @@ "scripts": { | ||
"what3words", | ||
"mapquest" | ||
"mapquest", | ||
"mapzen" | ||
], | ||
@@ -40,4 +41,5 @@ "author": "Per Liedman <per@liedman.net>", | ||
"browserify": "^11.0.1", | ||
"browserify-shim": "^3.8.10" | ||
"browserify-shim": "^3.8.10", | ||
"es3ify": "^0.1.4" | ||
} | ||
} |
@@ -23,2 +23,3 @@ ## A few words on diversity in tech | ||
* [Photon](http://photon.komoot.de/) | ||
* [Mapzen Search](https://mapzen.com/projects/search) | ||
@@ -25,0 +26,0 @@ The plugin can easily be extended to support other providers. |
@@ -36,3 +36,3 @@ var L = require('leaflet'), | ||
geocode: function(query, cb, context) { | ||
Util.jsonp(this.options.serviceUrl + 'search/', L.extend({ | ||
Util.jsonp(this.options.serviceUrl + 'search', L.extend({ | ||
q: query, | ||
@@ -64,3 +64,3 @@ limit: 5, | ||
reverse: function(location, scale, cb, context) { | ||
Util.jsonp(this.options.serviceUrl + 'reverse/', L.extend({ | ||
Util.jsonp(this.options.serviceUrl + 'reverse', L.extend({ | ||
lat: location.lat, | ||
@@ -67,0 +67,0 @@ lon: location.lng, |
@@ -9,3 +9,4 @@ var L = require('leaflet'), | ||
Google = require('./geocoders/google'), | ||
Photon = require('./geocoders/photon'); | ||
Photon = require('./geocoders/photon'), | ||
Mapzen = require('./geocoders/mapzen'); | ||
@@ -26,3 +27,5 @@ module.exports = L.Util.extend(Control.class, { | ||
Photon: Photon.class, | ||
photon: Photon.factory | ||
photon: Photon.factory, | ||
Mapzen: Mapzen.class, | ||
mapzen: Mapzen.factory | ||
}); | ||
@@ -29,0 +32,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
99167
31
2008
159
0
3