From 15ee63e87526be50431de2d98f298deb7789d0ae Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 5 Aug 2021 16:59:07 -0400 Subject: [PATCH] Improve code for keeping only interesting key/value pairs Before it was not actually checking that the osmvalue was in the vmap, so we were testing a bunch of pairs like `highway/crossing` and `highway/residential` that would never match a NSI category. --- modules/services/nsi.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/services/nsi.js b/modules/services/nsi.js index 99e63dcb6..509eaabed 100644 --- a/modules/services/nsi.js +++ b/modules/services/nsi.js @@ -163,7 +163,7 @@ function loadNsiData() { // and fallbacks like // "amenity/yes" // excluding things like -// "highway", "surface", "ref", etc. +// "tiger:reviewed", "surface", "ref", etc. // // Arguments // `tags`: `Object` containing the feature's OSM tags @@ -183,12 +183,12 @@ function gatherKVs(tags) { if (!osmvalue) return; const vmap = _nsi.kvt.get(osmkey); - if (!vmap) return; + if (!vmap) return; // not an interesting key - if (osmvalue !== 'yes') { - primary.add(`${osmkey}/${osmvalue}`); - } else { - alternate.add(`${osmkey}/${osmvalue}`); + if (vmap.get(osmvalue)) { // Matched a category in NSI + primary.add(`${osmkey}/${osmvalue}`); // interesting key/value + } else if (osmvalue === 'yes') { + alternate.add(`${osmkey}/${osmvalue}`); // fallback key/yes } });