1 | /* measurement values and units warnings (ticket #8687) */
|
---|
2 |
|
---|
3 | *[/^[0-9]+$/] {
|
---|
4 | throwWarning: tr("numerical key");
|
---|
5 | assertMatch: "way 123=foo";
|
---|
6 | assertNoMatch: "way ref.1=foo";
|
---|
7 | }
|
---|
8 |
|
---|
9 | *[layer =~ /\+.*/] {
|
---|
10 | throwWarning: tr("layer tag with + sign");
|
---|
11 | fixAdd: concat("layer=", replace(tag("layer"), "+", ""));
|
---|
12 | assertMatch: "node layer=+1";
|
---|
13 | assertNoMatch: "node layer=1";
|
---|
14 | assertNoMatch: "node layer=-1";
|
---|
15 | }
|
---|
16 |
|
---|
17 | *[layer][layer !~ /^0$|^(-|\+)?[1-5]$/] {
|
---|
18 | throwWarning: tr("layer should be between -5 and 5");
|
---|
19 | assertMatch: "node layer=-50";
|
---|
20 | assertMatch: "node layer=6";
|
---|
21 | assertMatch: "node layer=+100";
|
---|
22 | assertNoMatch: "node layer=-5";
|
---|
23 | assertNoMatch: "node layer=0";
|
---|
24 | assertNoMatch: "node layer=2";
|
---|
25 | assertNoMatch: "node layer=+5";
|
---|
26 | }
|
---|
27 |
|
---|
28 | *[level][level !~ /^((([0-9]|-[1-9])|[1-9][0-9]*)(\.5)?)(;(([0-9]|-[1-9])|[1-9][0-9]*)(\.5)?)*$|^-0\.5$/] {
|
---|
29 | throwWarning: tr("level should be numbers with optional .5 increments");
|
---|
30 | assertMatch: "node level=one";
|
---|
31 | assertNoMatch: "node level=0";
|
---|
32 | assertNoMatch: "node level=1";
|
---|
33 | assertNoMatch: "node level=-1";
|
---|
34 | assertNoMatch: "node level=-0.5";
|
---|
35 | assertNoMatch: "node level=1.5";
|
---|
36 | }
|
---|
37 |
|
---|
38 | *[height][height !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([1-9][0-9]*\'((10|11|[0-9])((\.[0-9]+)?)\")?))$/] {
|
---|
39 | throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "height");
|
---|
40 | assertMatch: "node height=medium";
|
---|
41 | assertMatch: "node height=-5";
|
---|
42 | assertNoMatch: "node height=2 m";
|
---|
43 | assertNoMatch: "node height=5";
|
---|
44 | assertNoMatch: "node height=7.8";
|
---|
45 | assertNoMatch: "node height=20 ft";
|
---|
46 | assertNoMatch: "node height=22'";
|
---|
47 | }
|
---|
48 |
|
---|
49 | *[maxheight][maxheight !~ /^(([1-9][0-9]*(\.[0-9]+)?( (m|ft))?)|([0-9]+\'(([0-9]|10|11)(\.[0-9]*)?\")?))$/] {
|
---|
50 | throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "maxheight");
|
---|
51 | assertMatch: "node maxheight=something";
|
---|
52 | assertMatch: "node maxheight=-5";
|
---|
53 | assertMatch: "node maxheight=0";
|
---|
54 | assertNoMatch: "node maxheight=4";
|
---|
55 | assertNoMatch: "node maxheight=3.5";
|
---|
56 | assertNoMatch: "node maxheight=2 m";
|
---|
57 | assertNoMatch: "node maxheight=14 ft";
|
---|
58 | assertNoMatch: "node maxheight=10'";
|
---|
59 | assertNoMatch: "node maxheight=16'3\"";
|
---|
60 | }
|
---|
61 |
|
---|
62 | way[width][width !~ /^(([0-9]+\.?[0-9]*( [a-z]+)?)|([0-9]+\'([0-9]+\.?[0-9]*\")?))$/] {
|
---|
63 | throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "width");
|
---|
64 | assertMatch: "way width=something";
|
---|
65 | assertMatch: "way width=-5";
|
---|
66 | assertNoMatch: "way width=3";
|
---|
67 | assertNoMatch: "way width=0.5";
|
---|
68 | assertNoMatch: "way width=1 m";
|
---|
69 | assertNoMatch: "way width=10 ft";
|
---|
70 | assertNoMatch: "way width=1'";
|
---|
71 | assertNoMatch: "way width=10'5\"";
|
---|
72 | }
|
---|
73 |
|
---|
74 | *[maxwidth][maxwidth !~ /^(([0-9]+\.?[0-9]*( (m|ft))?)|([0-9]+\'[0-9]+\.?[0-9]*\"))$/] {
|
---|
75 | throwWarning: tr("{0}: meters is default; period is separator; if units, put space then unit", "maxwidth");
|
---|
76 | assertMatch: "way maxwidth=something";
|
---|
77 | assertMatch: "way maxwidth=-5";
|
---|
78 | assertNoMatch: "way maxwidth=2";
|
---|
79 | assertNoMatch: "way maxwidth=6'6\"";
|
---|
80 | assertNoMatch: "way maxwidth=2.5";
|
---|
81 | assertNoMatch: "way maxwidth=7 ft";
|
---|
82 | }
|
---|
83 |
|
---|
84 | way[maxspeed][maxspeed !~ /^(signals|none|unposted|unknown|variable|walk|[1-9][0-9]*( [a-z]+)?|[A-Z][A-Z]:(urban|rural|living_street|motorway))$/] {
|
---|
85 | throwWarning: tr("unusual {0} format", "maxspeed");
|
---|
86 | assertMatch: "way maxspeed=something";
|
---|
87 | assertMatch: "way maxspeed=-50";
|
---|
88 | assertMatch: "way maxspeed=0";
|
---|
89 | assertNoMatch: "way maxspeed=50";
|
---|
90 | assertNoMatch: "way maxspeed=30 mph";
|
---|
91 | assertNoMatch: "way maxspeed=RO:urban";
|
---|
92 | assertNoMatch: "way maxspeed=RU:rural";
|
---|
93 | assertNoMatch: "way maxspeed=RU:living_street";
|
---|
94 | assertNoMatch: "way maxspeed=DE:motorway";
|
---|
95 | assertNoMatch: "way maxspeed=signals";
|
---|
96 | assertNoMatch: "way maxspeed=none";
|
---|
97 | assertNoMatch: "way maxspeed=variable";
|
---|
98 | }
|
---|
99 |
|
---|
100 | way[voltage][voltage =~ /(.*[A-Za-z].*)|.*,.*|.*( ).*/] {
|
---|
101 | throwWarning: tr("voltage should be in volts with no units/delimiter/spaces");
|
---|
102 | assertMatch: "way voltage=medium";
|
---|
103 | assertNoMatch: "way voltage=15000";
|
---|
104 | }
|
---|
105 |
|
---|
106 | /* some users are using frequency for other purposes (not electromagnetic)
|
---|
107 | with the values 'perennial' and 'intermittent'; the vast majority are 0, 16.7, 50 and 60 */
|
---|
108 | way[frequency][frequency !~ /^(0|[1-9][0-9]*(\.[0-9]+)?)( (kHz|MHz|GHz|THz))?$/] {
|
---|
109 | throwWarning: tr("unusual {0} specification", "frequency");
|
---|
110 | assertMatch: "way frequency=something";
|
---|
111 | assertNoMatch: "way frequency=0"; /* DC */
|
---|
112 | assertNoMatch: "way frequency=16.7";
|
---|
113 | assertNoMatch: "way frequency=50";
|
---|
114 | assertNoMatch: "way frequency=680 kHz";
|
---|
115 | assertNoMatch: "way frequency=123.5 MHz";
|
---|
116 | }
|
---|
117 |
|
---|
118 | way[gauge][gauge !~ /^([1-9][0-9]{1,3}(;[1-9][0-9]{1,3})*|broad|standard|narrow)$/] {
|
---|
119 | throwWarning: tr("unusual train track gauge; use mm with no separator");
|
---|
120 | assertMatch: "way gauge=something";
|
---|
121 | assertNoMatch: "way gauge=1435";
|
---|
122 | assertNoMatch: "way gauge=1000;1435";
|
---|
123 | assertNoMatch: "way gauge=standard";
|
---|
124 | assertNoMatch: "way gauge=narrow";
|
---|
125 | }
|
---|
126 |
|
---|
127 | /* the numbers for percentage and degrees include could probably be bracketed a bit more precisely */
|
---|
128 | way[incline][incline !~ /^(up|down|-?([0-9]+?(\.[1-9]%)?|100)[%°]?)$/] {
|
---|
129 | throwWarning: tr("unusual incline; use percentages/degrees or up/down");
|
---|
130 | assertMatch: "way incline=extreme";
|
---|
131 | assertNoMatch: "way incline=up";
|
---|
132 | assertNoMatch: "way incline=down";
|
---|
133 | assertNoMatch: "way incline=10%";
|
---|
134 | assertNoMatch: "way incline=-5%";
|
---|
135 | assertNoMatch: "way incline=10°";
|
---|
136 | }
|
---|
137 |
|
---|
138 | /* see ticket #9631 */
|
---|
139 | *[population][population !~ /^[0-9]+$/ ] {
|
---|
140 | throwWarning: tr("{0} must be a numeric value", "{0.key}");
|
---|
141 | }
|
---|