Skip to content

Commit

Permalink
Don't count tags under the name namespace as descriptive tags (close
Browse files Browse the repository at this point in the history
…#8273)

Don't count `description`, `note`, `start_date`, or tags under those namespaces as descriptive tags
  • Loading branch information
quincylvania committed Jan 5, 2021
1 parent 1997aa2 commit 2c2eabb
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions modules/validations/missing_tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ export function validationMissingTag(context) {
var type = 'missing_tag';

function hasDescriptiveTags(entity, graph) {
var keys = Object.keys(entity.tags)
var onlyDescriptiveKeys = ['description', 'name', 'note', 'start_date'];
var entityDescriptiveKeys = Object.keys(entity.tags)
.filter(function(k) {
if (k === 'area' || k === 'name') {
return false;
} else {
return osmIsInterestingTag(k);
}
if (k === 'area' || !osmIsInterestingTag(k)) return false;

return !onlyDescriptiveKeys.some(function(desciptiveKey) {
return k === desciptiveKey || k.indexOf(desciptiveKey + ':') === 0;
});
});

if (entity.type === 'relation' &&
keys.length === 1 &&
entityDescriptiveKeys.length === 1 &&
entity.tags.type === 'multipolygon') {
// this relation's only interesting tag just says its a multipolygon,
// which is not descriptive enough
Expand All @@ -30,7 +31,7 @@ export function validationMissingTag(context) {
return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
}

return keys.length > 0;
return entityDescriptiveKeys.length > 0;
}

function isUnknownRoad(entity) {
Expand Down

0 comments on commit 2c2eabb

Please sign in to comment.