source: josm/trunk/resources/data/validator/highway.mapcss@ 17048

Last change on this file since 17048 was 16678, checked in by Klumbumbus, 4 years ago

fix #19410 - Improve warning message

  • Property svn:eol-style set to native
File size: 6.7 KB
Line 
1way[highway=~/^(motorway|trunk|primary|secondary|tertiary)$/] {
2 set major_road;
3}
4way[highway=~/^.*_link$/] {
5 set link_road;
6}
7way[highway=~/^(unclassified|residential|living_street|service)$/] {
8 set minor_road;
9}
10
11way[highway][name =~ /(?i).* (Ave|Blvd|Br|Brg|Cct|Cir|Cl|Cr|Crct|Cres|Crt|Ct|Dr|Drv|Esp|Espl|Hwy|Ln|Mw|Mwy|Pky|Pkwy|Pl|Rd|Qy|Qys|Sq|St|Str|Ter|Tce|Tr|Wy)[.]?$/] {
12 throwWarning: tr("abbreviated street name");
13 assertMatch: "way highway=unclassified name=\"Foo Ave\"";
14 assertMatch: "way highway=unclassified name=\"Foo Ave.\"";
15 assertMatch: "way highway=unclassified name=\"Bou Blvd.\"";
16 assertMatch: "way highway=unclassified name=\"Bou blvd.\"";
17}
18
19node[highway =~ /motorway|trunk|primary|secondary|tertiary|unclassified|residential|service|living_street|pedestrian|track|path|footway|cycleway|bus_guideway|bridleway/][highway!=motorway_junction][highway!=services] {
20 throwWarning: tr("wrong highway tag on a node");
21 assertMatch: "node highway=primary";
22 assertMatch: "node highway=primary_link";
23 assertNoMatch: "node highway=traffic_calming";
24 assertNoMatch: "node highway=bus_stop";
25 assertNoMatch: "node highway=crossing";
26 assertNoMatch: "node highway=emergency_access_point";
27 assertNoMatch: "node highway=give_way";
28 assertNoMatch: "node highway=mini_roundabout";
29 assertNoMatch: "node highway=motorway_junction";
30 assertNoMatch: "node highway=passing_place";
31 assertNoMatch: "node highway=rest_area";
32 assertNoMatch: "node highway=speed_camera";
33 assertNoMatch: "node highway=street_lamp";
34 assertNoMatch: "node highway=services";
35 assertNoMatch: "node highway=stop";
36 assertNoMatch: "node highway=traffic_signals";
37 assertNoMatch: "node highway=turning_circle";
38}
39
40way[highway=crossing],
41way[railway=crossing],
42way[railway=level_crossing] {
43 throwWarning: tr("wrong crossing tag on a way");
44 assertMatch: "way highway=crossing";
45 assertNoMatch: "node highway=crossing";
46}
47
48/* #18060 */
49node[footway=crossing] {
50 throwWarning: tr("{0} on a node", "{0.tag}");
51 suggestAlternative: "highway=crossing";
52 suggestAlternative: "railway=crossing";
53}
54node[cycleway=crossing] {
55 throwWarning: tr("{0} on a node", "{0.tag}");
56 suggestAlternative: "highway=crossing + bicycle=yes";
57 suggestAlternative: "railway=crossing + bicycle=yes";
58}
59
60way[highway=unclassified][!name][noname!=yes] {
61 throwOther: tr("Unnamed unclassified highway");
62 assertMatch: "way highway=unclassified";
63 assertNoMatch: "way highway=unclassified noname=yes";
64 assertNoMatch: "way highway=unclassified name=Foo";
65}
66
67/* #17970 */
68relation[type=route][route=road][ref] > way.major_road {
69 set road_route_has_ref;
70}
71way.major_road!.road_route_has_ref[!ref][!destination:ref][noref!=yes][junction!=roundabout] {
72 throwOther: tr("highway without a reference");
73 group: tr("missing tag");
74 assertMatch: "way highway=primary";
75 assertNoMatch: "way highway=primary ref=123";
76 assertNoMatch: "way highway=primary destination:ref=123";
77 assertNoMatch: "way highway=primary noref=yes";
78}
79
80way[highway=yes],
81way[highway=road] {
82 throwWarning: tr("Unspecific highway type");
83 assertMatch: "way highway=road";
84 assertNoMatch: "way highway=residential";
85}
86
87way[highway=footway][maxspeed],
88way[highway=steps][maxspeed],
89way[highway=cycleway][bicycle=no],
90way[highway=footway][foot=no],
91way[highway=cycleway][cycleway=lane] {
92 throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
93 assertNoMatch: "way highway=cycleway bicycle=yes";
94 assertNoMatch: "way highway=cycleway";
95 assertNoMatch: "way highway=footway foot=yes";
96 assertNoMatch: "way highway=footway";
97 assertMatch: "way highway=cycleway cycleway=lane";
98 assertNoMatch: "way highway=cycleway";
99 assertNoMatch: "way highway=residential cycleway=lane";
100 assertMatch: "way highway=footway maxspeed=20";
101 assertNoMatch: "way highway=residential maxspeed=20";
102 assertNoMatch: "way highway=footway";
103}
104
105/* footway, see #10851, #10976, #15439, #19389 */
106way[footway=left][/^footway:/],
107way[footway=right][/^footway:/],
108way[footway=both][/^footway:/],
109way[footway=no][/^footway:/] {
110 throwWarning: tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}", "{0.tag}", "sidewalk", "{1.key}");
111 group: tr("deprecated tagging");
112 set not_fixable_footway;
113 assertMatch: "way footway=both footway:surface=asphalt";
114}
115way[footway=none][/footway:/] {
116 throwWarning: tr("{0} is deprecated, use {1} instead. Also check similar tags like {2}", "{0.tag}", "sidewalk=no", "{1.key}");
117 group: tr("deprecated tagging");
118 set not_fixable_footway;
119}
120way[footway=left]!.not_fixable_footway,
121way[footway=right]!.not_fixable_footway,
122way[footway=both]!.not_fixable_footway,
123way[footway=no]!.not_fixable_footway {
124 throwWarning: tr("{0} is deprecated", "{0.tag}");
125 suggestAlternative: "sidewalk";
126 group: tr("deprecated tagging");
127 fixChangeKey: "footway => sidewalk";
128 set fixable_footway;
129}
130way[footway=none]!.not_fixable_footway {
131 throwWarning: tr("{0} is deprecated", "{0.tag}");
132 suggestAlternative: "sidewalk=no";
133 group: tr("deprecated tagging");
134 fixRemove: "footway";
135 fixAdd: "sidewalk=no";
136 set fixable_footway;
137}
138way[footway][footway!=access_aisle][footway!=crossing][footway!=sidewalk]!.fixable_footway!.not_fixable_footway { /* do not trigger this rule if already one of the 4 previous rules applied */
139 throwWarning: tr("Value of {0} should either be {1}, {2} or {3}. For sidewalks use {4} instead.", "{0.key}", "{1.value}", "{2.value}", "{3.value}", "sidewalk=left|right|both|no");
140 assertNoMatch: "way footway=left";
141 assertNoMatch: "way footway=none";
142 assertNoMatch: "way footway=left footway:left:surface=asphalt";
143 assertMatch: "way footway=bar";
144}
145
146/* #11270, #9297, #15439, #16424, #17022 */
147way[railway =~ /^(miniature|narrow_gauge|preserved|rail)$/][!highway] > node { set .is_in_railway }
148way[highway =~ /^(bridleway|cycleway|footway|path|steps)$/] > node { set .is_in_minor_road }
149way[highway =~ /^(bus_guideway|living_street|motorway|motorway_link|pedestrian|primary|primary_link|raceway|residential|road|secondary|secondary_link|service|tertiary|tertiary_link|track|trunk|trunk_link|unclassified)$/] > node { set .is_in_major_road }
150node[railway!=crossing][crossing!=no].is_in_railway.is_in_minor_road!.is_in_major_road {
151 throwWarning: tr("pedestrian railway crossing without {0}", "{0.tag}");
152 group: tr("missing tag");
153 fixAdd: "railway=crossing";
154}
155node[railway!=level_crossing].is_in_railway.is_in_major_road!.is_in_minor_road {
156 throwWarning: tr("railway crossing without {0}", "{0.tag}");
157 group: tr("missing tag");
158 fixAdd: "railway=level_crossing";
159}
160
161node[highway=crossing][barrier=kerb].is_in_major_road {
162 throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
163 suggestAlternative: "kerb=*";
164 group: tr("suspicious tag combination");
165}
Note: See TracBrowser for help on using the repository browser.