From bcdf6b9e71f39a1b8469e864df6696609fbcf5ea Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Wed, 23 Apr 2025 11:55:13 +0200 Subject: [PATCH] add some additional tag keys to list of not-interesting tags --- modules/osm/tags.js | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/modules/osm/tags.js b/modules/osm/tags.js index 265f1e8b6..a7d0448a2 100644 --- a/modules/osm/tags.js +++ b/modules/osm/tags.js @@ -1,13 +1,37 @@ import { merge } from 'lodash-es'; +const uninterestingKeys = new Set([ + 'attribution', + 'created_by', + 'import_uuid', + 'geobase:datasetName', + 'geobase:uuid', + 'KSJ2:curve_id', + 'KSJ2:lat', + 'KSJ2:long', + 'lat', + 'latitude', + 'lon', + 'longitude', + 'source', + 'source_ref', + 'odbl', + 'odbl:note' +]); +const uninterestingKeyRegex = /^(source(_ref)?|tiger):/; + +/** + * Returns whether the given OSM tag key is potentially "interesting". + * For example, some tags are deemed not interesting because the respective tag is + * considered "discardable". + * + * @param {string} key the key to test + * @returns {boolean} + */ export function osmIsInterestingTag(key) { - return key !== 'attribution' && - key !== 'created_by' && - key !== 'source' && - key !== 'odbl' && - key.indexOf('source:') !== 0 && - key.indexOf('source_ref') !== 0 && // purposely exclude colon - key.indexOf('tiger:') !== 0; + if (uninterestingKeys.has(key)) return false; + if (uninterestingKeyRegex.test(key)) return false; + return true; } export const osmLifecyclePrefixes = {