Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add crossing:markings tag when connecting crossing #9586

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions modules/validations/crossing_ways.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,24 @@ export function validationCrossingWays(context) {
if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
// one feature is a path but not both

if (!bothLines) return {};

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', 'traffic_signals', 'uncontrolled'].indexOf(pathFeature.tags.crossing) !== -1) {
// if the path is a crossing, match the crossing type
return bothLines ? { highway: 'crossing', crossing: pathFeature.tags.crossing } : {};
// if the path is a crossing, match the crossing type and markings
var tags = { highway: 'crossing', crossing: pathFeature.tags.crossing };
if ('crossing:markings' in pathFeature.tags) {
tags['crossing:markings'] = pathFeature.tags['crossing:markings'];
}
return tags;
}
// don't add a `crossing` subtag to ambiguous crossings
return bothLines ? { highway: 'crossing' } : {};
return { highway: 'crossing' };
}
return {};
}
Expand Down
10 changes: 10 additions & 0 deletions test/spec/validations/crossing_ways.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ describe('iD.validations.crossing_ways', function () {
verifySingleCrossingIssue(validate(), { highway: 'crossing', crossing: 'unmarked' });
});

it('copies over `crossing:markings`', function() {
createWaysWithOneCrossingPoint({ highway: 'residential' }, { highway: 'footway', crossing: 'marked', 'crossing:markings': 'zebra' });
verifySingleCrossingIssue(validate(), { highway: 'crossing', crossing: 'marked', 'crossing:markings': 'zebra' });
});

it('does not copy `crossing` and `crossing:markings` if the `crossing` tag has an unknown value', function() {
createWaysWithOneCrossingPoint({ highway: 'residential' }, { highway: 'footway', crossing: 'zebra', 'crossing:markings': 'zebra' });
verifySingleCrossingIssue(validate(), { highway: 'crossing' });
});

it('flags road=track crossing footway', function() {
createWaysWithOneCrossingPoint({ highway: 'track' }, { highway: 'footway' });
verifySingleCrossingIssue(validate(), {});
Expand Down
Loading