in modules/validations/crossing_ways.js [126:183]
function tagsForConnectionNodeIfAllowed(entity1, entity2) {
var featureType1 = getFeatureTypeForTags(entity1.tags);
var featureType2 = getFeatureTypeForTags(entity2.tags);
if (featureType1 === featureType2) {
if (featureType1 === 'highway') {
var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
// one feature is a path but not both
var roadFeature = entity1IsPath ? entity2 : entity1;
if (nonCrossingHighways[roadFeature.tags.highway]) {
// don't mark path connections with certain roads as crossings
return {};
}
var pathFeature = entity1IsPath ? entity1 : entity2;
if (['marked', 'unmarked'].indexOf(pathFeature.tags.crossing) !== -1) {
// if the path is a crossing, match the crossing type
return { highway: 'crossing', crossing: pathFeature.tags.crossing };
}
// don't add a `crossing` subtag to ambiguous crossings
return { highway: 'crossing' };
}
return {};
}
if (featureType1 === 'waterway') return {};
if (featureType1 === 'railway') return {};
} else {
var featureTypes = [featureType1, featureType2];
if (featureTypes.indexOf('highway') !== -1) {
if (featureTypes.indexOf('railway') !== -1) {
if (osmPathHighwayTagValues[entity1.tags.highway] ||
osmPathHighwayTagValues[entity2.tags.highway]) {
// path-rail connections use this tag
return { railway: 'crossing' };
} else {
// road-rail connections use this tag
return { railway: 'level_crossing' };
}
}
if (featureTypes.indexOf('waterway') !== -1) {
// do not allow fords on structures
if (hasTag(entity1.tags, 'tunnel') && hasTag(entity2.tags, 'tunnel')) return null;
if (hasTag(entity1.tags, 'bridge') && hasTag(entity2.tags, 'bridge')) return null;
if (highwaysDisallowingFords[entity1.tags.highway] ||
highwaysDisallowingFords[entity2.tags.highway]) {
// do not allow fords on major highways
return null;
}
return { ford: 'yes' };
}
}
}
return null;
}