﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
10083	Wrong *:lanes counting	mdk	team	"I have tagged a highway with {{{oneway=yes}}}, {{{lanes=2}}} and {{{destination:lanes=A14|A2}}}. The validator complains about **Number of lanes greater than *:lanes**. When I change the value to {{{destination:lanes=A|B}}}, the warning disappears. But also {{{destination:lanes=A|B|C}}} didn't cause a warning, even if there are 3 values for only 2 lanes.

For me this looks like the validator is extracting a number from the value instead of counting the separated values.

I search taginfo for common usage of *:lanes tags and I found 3 different value types.
1. According to the wiki [http://wiki.openstreetmap.org/wiki/Lanes] there are separate values for each lane separated by the '|' symbol. In this case the number of these delimiters must be count. The number of lanes is number of delimiters +1. This should be implemented (see #8519) but it doesn’t work correctly in this case. The most used keys are: {{{turn:lanes}}}, {{{change:lanes}}}, {{{destination:lanes}}}, {{{access:lanes}}}, {{{width:lanes}}}, {{{bicycle:lanes}}}, {{{bus:lanes}}}, {{{psv;lanes}}}.
2. Some keys like {{{note:lanes}}} and {{{source:lanes}}} only have a single text value and could be ignored for lane counting.
3. The last group has keys like {{{proposed:lanes}}} or {{{piste:lanes}}} which have a single integer value. 

We can distinguish between the different value types the following way (pseudo code):
{{{
if (value.contains('|')) {
   lanes = value.count('|') + 1;
} else if (value.isInteger()) {
   lanes = value;
} else {
   ignore this tag;
}
}}}
Only use the value as integer, if there are absolutely no other characters than '0'-'9'!

In the attached file {{{destination:lanes=A14|A2}}} shouldn't cause a warning, but {{{bus:lanes=no|designated|yes}}} should cause a warning instead.

Perhaps this validator test messed up {{{*:lanes}}} and {{{lanes:*}}} values. The more unspecific keys like {{{lanes:psv}}} or {{{lanes:bus}}} really have integer values in contrast to {{{psv:lanes}}} or {{{bus:lanes}}}.

The ""Lane and road attributes"" map paint style is very helpful when working with these keys."	defect	closed	normal	14.12	Core validator	latest	fixed	lanes	imagic
