Merge pull request #5826 from SilentSpike/reverse-turns

Fix turn:lanes changing when way is reversed
This commit is contained in:
Bryan Housel
2019-01-29 09:31:41 -05:00
committed by GitHub

View File

@@ -20,6 +20,7 @@ References:
export function actionReverse(wayID, options) {
var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
var numeric = /^([+\-]?)(?=[\d.])/;
var turn_lanes = /^turn:lanes:?/;
var keyReplacements = [
[/:right$/, ':left'],
[/:left$/, ':right'],
@@ -63,7 +64,10 @@ export function actionReverse(wayID, options) {
function reverseValue(key, value) {
if (ignoreKey.test(key)) return value;
if (key === 'incline' && numeric.test(value)) {
// Turn lanes are left/right to key (not way) direction - #5674
if (turn_lanes.test(key)) {
return value
} else if (key === 'incline' && numeric.test(value)) {
return value.replace(numeric, function(_, sign) { return sign === '-' ? '' : '-'; });
} else if (options && options.reverseOneway && key === 'oneway') {
return onewayReplacements[value] || value;