Add implementation for left/right exchange on direction tags.

This commit is contained in:
Jon D
2016-08-25 07:03:35 +01:00
parent 95ac00ffbf
commit 1b09b0dd60
+4 -3
View File
@@ -28,7 +28,9 @@ import _ from 'lodash';
Node Keys:
direction=forward ⟺ direction=backward
*:forward=* ⟺ *:backward=*
direction=left ⟺ direction=right
*:forward=* ⟺ *:backward=*
*:left=* ⟺ *:right=*
References:
http://wiki.openstreetmap.org/wiki/Forward_%26_backward,_left_%26_right
@@ -81,8 +83,7 @@ export function Reverse(wayId, options) {
return node.update({tags: _.transform(node.tags, function(acc, tagValue, tagKey) {
// See if this is a direction tag and reverse (or use existing value if not forward/backward)
if (tagKey === 'direction') {
acc[tagKey] = tagValue === 'forward' ? 'backward'
: tagValue === 'backward' ? 'forward' : tagValue;
acc[tagKey] = {forward: 'backward', backward: 'forward', left: 'right', right: 'left'}[tagValue] || tagValue;
} else {
// Use the reverseKey method to cater for situations such as traffic_sign:forward=stop
// This will pass through other tags unchanged