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

Last change on this file since 17388 was 17388, checked in by Klumbumbus, 3 months ago

fix #20117 - Warn about abbreviated street names:

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