From 70d078ba2c030bd55927e6be2775600ba492c7d9 Mon Sep 17 00:00:00 2001 From: intergalacticdata <39782500+intergalacticdata@users.noreply.github.com> Date: Wed, 30 May 2018 19:21:28 -0700 Subject: [PATCH 1/3] calling encodeURIComponent on msa_tag(s) breaks place:city --- leaflet.photon.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/leaflet.photon.js b/leaflet.photon.js index ba5eff4..55cb9b2 100644 --- a/leaflet.photon.js +++ b/leaflet.photon.js @@ -31,8 +31,12 @@ L.PhotonBase = L.Class.extend({ buildQueryString: function (params) { var queryString = []; for (var key in params) { - if (params[key]) { + if (params[key] && typeof(params[key]) == 'string') { queryString.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key])); + } else if (params[key]) { + for (i = 0; i < params[key].length; i++) { + queryString.push(encodeURIComponent(key) + '=' + params[key][i]); + } } } return queryString.join('&'); From 793b1ad009fe06682d696f9071b9527988658e26 Mon Sep 17 00:00:00 2001 From: intergalacticdata <39782500+intergalacticdata@users.noreply.github.com> Date: Thu, 31 May 2018 09:47:32 -0700 Subject: [PATCH 2/3] cleanup logic verifies that non-strings have a length > 0. removes string encoding - osm_tag place:value combos are currently broken due to encoding the colon. --- leaflet.photon.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/leaflet.photon.js b/leaflet.photon.js index 55cb9b2..c494d48 100644 --- a/leaflet.photon.js +++ b/leaflet.photon.js @@ -32,8 +32,8 @@ L.PhotonBase = L.Class.extend({ var queryString = []; for (var key in params) { if (params[key] && typeof(params[key]) == 'string') { - queryString.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key])); - } else if (params[key]) { + queryString.push(encodeURIComponent(key) + '=' + params[key]); + } else if (params[key] && params[key].length) { for (i = 0; i < params[key].length; i++) { queryString.push(encodeURIComponent(key) + '=' + params[key][i]); } From 2a7e38cb5e9de9dd70bfd5e1e4e216f18d4566b6 Mon Sep 17 00:00:00 2001 From: intergalacticdata <39782500+intergalacticdata@users.noreply.github.com> Date: Thu, 31 May 2018 18:03:03 -0700 Subject: [PATCH 3/3] i broke location passing. this fixes it. --- leaflet.photon.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/leaflet.photon.js b/leaflet.photon.js index c494d48..2f373ca 100644 --- a/leaflet.photon.js +++ b/leaflet.photon.js @@ -31,7 +31,7 @@ L.PhotonBase = L.Class.extend({ buildQueryString: function (params) { var queryString = []; for (var key in params) { - if (params[key] && typeof(params[key]) == 'string') { + if (params[key] && (typeof(params[key]) == 'string' || typeof(params[key]) == 'number')) { queryString.push(encodeURIComponent(key) + '=' + params[key]); } else if (params[key] && params[key].length) { for (i = 0; i < params[key].length; i++) { @@ -376,7 +376,7 @@ L.PhotonSearch = L.PhotonBaseSearch.extend({ }, _onSelected: function (feature) { - this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]], 16); + this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]]); }, getParams: function () {