From 1b09b0dd60ea5b12c849a40c5d4858096f6a1383 Mon Sep 17 00:00:00 2001 From: Jon D Date: Thu, 25 Aug 2016 07:03:35 +0100 Subject: [PATCH] Add implementation for left/right exchange on direction tags. --- modules/actions/reverse.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/actions/reverse.js b/modules/actions/reverse.js index 8d896047f..cb4697e79 100644 --- a/modules/actions/reverse.js +++ b/modules/actions/reverse.js @@ -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