in modules/validations/mismatched_geometry.js [211:285]
function otherMismatchIssue(entity, graph) {
// ignore boring features
if (!entity.hasInterestingTags()) return null;
if (entity.type !== 'node' && entity.type !== 'way') return null;
// address lines are special so just ignore them
if (entity.type === 'node' && entity.isOnAddressLine(graph)) return null;
var sourceGeom = entity.geometry(graph);
var targetGeoms = entity.type === 'way' ? ['point', 'vertex'] : ['line', 'area'];
if (sourceGeom === 'area') targetGeoms.unshift('line');
var asSource = presetManager.match(entity, graph);
var targetGeom = targetGeoms.find(nodeGeom => {
var asTarget = presetManager.matchTags(entity.tags, nodeGeom);
if (!asSource || !asTarget ||
asSource === asTarget ||
// sometimes there are two presets with the same tags for different geometries
deepEqual(asSource.tags, asTarget.tags)) return false;
if (asTarget.isFallback()) return false;
var primaryKey = Object.keys(asTarget.tags)[0];
// special case: buildings-as-points are discouraged by iD, but common in OSM, so ignore them
if (primaryKey === 'building') return false;
if (asTarget.tags[primaryKey] === '*') return false;
return asSource.isFallback() || asSource.tags[primaryKey] === '*';
});
if (!targetGeom) return null;
var subtype = targetGeom + '_as_' + sourceGeom;
if (targetGeom === 'vertex') targetGeom = 'point';
if (sourceGeom === 'vertex') sourceGeom = 'point';
var referenceId = targetGeom + '_as_' + sourceGeom;
var dynamicFixes;
if (targetGeom === 'point') {
dynamicFixes = extractPointDynamicFixes;
} else if (sourceGeom === 'area' && targetGeom === 'line') {
dynamicFixes = lineToAreaDynamicFixes;
}
return new validationIssue({
type: type,
subtype: subtype,
severity: 'warning',
message: function(context) {
var entity = context.hasEntity(this.entityIds[0]);
return entity ? t.html('issues.' + referenceId + '.message', {
feature: utilDisplayLabel(entity, targetGeom, true /* verbose */)
}) : '';
},
reference: function showReference(selection) {
selection.selectAll('.issue-reference')
.data([0])
.enter()
.append('div')
.attr('class', 'issue-reference')
.html(t.html('issues.mismatched_geometry.reference'));
},
entityIds: [entity.id],
dynamicFixes: dynamicFixes
});
}