source: josm/trunk/data/validator/combinations.mapcss @ 9415

Last change on this file since 9415 was 9415, checked in by Klumbumbus, 8 years ago

fix #12340 - support traffic_sign=countrycode:signcode in addition to traffic_sign=maxspeed in maxspeed on suspicious object validator test

  • Property svn:eol-style set to native
File size: 15.2 KB
Line 
1/* Rules partially derived from Taginfo statistics - see ticket #5017
2 * Taginfo query: select keypairs.key1, keypairs.key2, keypairs.count_all, keys.count_all, cast(keypairs.count_all as real)/keys.count_all as from_fraction_all from keys, keypairs where key1='waterway' and keys.key=keypairs.key2 and (key1<>'highway' or keypairs.count_all>12000) and (key1<>'railway' or keypairs.count_all>3000) and (key1<>'waterway' or keypairs.count_all>800) and key2 not like '%:%' and from_fraction_all>0.97 and 1 union select keypairs.key2, keypairs.key1, keypairs.count_all, keys.count_all, cast(keypairs.count_all as real)/keys.count_all as from_fraction_all from keys, keypairs where key2='waterway' and keys.key=keypairs.key1 and (key2<>'highway' or keypairs.count_all>12000) and (key2<>'railway' or keypairs.count_all>3000) and (key2<>'waterway' or keypairs.count_all>800) and key1 not like '%:%' and from_fraction_all>0.97 and 1 order by keypairs.count_all desc limit 1000;
3 */
4
5/* {0.key} without {1.key} (warning level) */
6way[junction                   ][!highway][junction!=yes],
7*[lanes                        ][!highway],
8*[lcn                          ][!highway],
9*[living_street                ][!highway],
10*[maintenance                  ][!highway],
11*[median                       ][!highway],
12*[motorroad                    ][!highway],
13*[ntd_id                       ][!highway],
14*[sac_scale                    ][!highway],
15*[sidewalk                     ][!highway],
16*[step_count                   ][!highway],
17*[tracktype                    ][!highway],
18*[trail_visibility             ][!highway],
19*[trolley_wire                 ][!highway],
20*[zip_left                     ][!highway],
21*[zip_right                    ][!highway],
22*[detail                       ][!railway][route!=railway],
23*[eddy_current_brake           ][!railway][route!=railway],
24*[electrified                  ][!railway][route!=railway],
25*[etcs                         ][!railway][route!=railway],
26*[gauge                        ][!railway][route!=railway],
27*[grade_of_track               ][!railway][route!=railway],
28*[kursbuchstrecke              ][!railway][route!=railway],
29*[lzb                          ][!railway][route!=railway],
30*[old_railway_operator         ][!railway][route!=railway],
31*[operating_procedure          ][!railway][route!=railway],
32*[pzb                          ][!railway][route!=railway],
33*[radio                        ][!railway][route!=railway],
34*[structure_gauge              ][!railway][route!=railway],
35*[tilting_technology           ][!railway][route!=railway],
36*[track_class                  ][!railway][route!=railway],
37*[tracks                       ][!railway][route!=railway],
38*[traffic_mode                 ][!railway][route!=railway],
39*[usage                        ][!railway][route!=railway],
40*[workrules                    ][!railway][route!=railway],
41*[stream                       ][!waterway],
42*[length_unit                  ][!waterway],
43*[llid                         ][!waterway],
44*[canal                        ][!waterway],
45*[have_riverbank               ][!waterway],
46*[border_type                  ][!boundary],
47*[bridge:structure             ][!bridge],
48*[piste:difficulty             ][!piste:type],
49*[source:date                  ][!source],
50*[source:name                  ][!name],
51*[source:maxspeed:forward      ][!maxspeed:forward],
52*[source:maxspeed:backward     ][!maxspeed:backward],
53*[source:maxspeed:forward      ][!source:maxspeed:backward],
54*[source:maxspeed:backward     ][!source:maxspeed:forward],
55*[source:building              ][!building],
56*[source:ref                   ][!ref],
57*[source:population            ][!population],
58*[source:postal_code           ][!postal_code],
59*[source:ele                   ][!ele],
60*[source:ref:INSEE             ][!ref:INSEE],
61*[source:lit                   ][!lit],
62*[source:hgv                   ][!hgv],
63*[source:highway               ][!highway],
64*[source:maxaxleload           ][!maxaxleload],
65*[source:surface               ][!surface],
66*[source:bridge                ][!bridge],
67*[source:old_name              ][!old_name],
68*[source:bicycle               ][!bicycle],
69*[source:designation           ][!designation],
70*[source:height                ][!height],
71*[source:lanes                 ][!lanes],
72*[source:postcode              ][!addr:postcode],
73*[source:housenumber           ][!addr:housenumber],
74*[source:addr:postcode         ][!addr:postcode],
75*[source:addr:housenumber      ][!addr:housenumber],
76*[source:addr                  ][!/^addr:/],
77*[source:maxspeed              ][!/^maxspeed:?/] {
78  throwWarning: tr("{0} without {1}", "{0.key}", "{1.key}");
79  assertMatch: "way lanes=42";
80  assertNoMatch: "way lanes=42 highway=unclassified";
81  assertMatch: "node source:addr:postcode=postman";
82  assertMatch: "node source:addr=postman";
83  assertNoMatch: "node source:addr=postman addr:housenumber=42";
84}
85
86/* {0.key} without {1.key} (info level) */
87*[lanes:forward][!lanes:backward][oneway!=yes][oneway!=-1],
88*[lanes:backward][!lanes:forward][oneway!=yes][oneway!=-1],
89*[leaf_type ][!leaf_cycle],
90*[leaf_cycle][!leaf_type] {
91  throwOther: tr("{0} without {1}", "{0.key}", "{1.key}");
92}
93
94/* {0.key} without {1.tag} */
95*[fence_type                   ][barrier!=fence],
96*[recycling_type               ][amenity!=recycling],
97*[information                  ][tourism!=information],
98*[board_type                   ][information!=board],
99*[shelter_type                 ][amenity!=shelter],
100*[lamp_type                    ][highway!=street_lamp],
101*[map_type                     ][information!=map],
102*[site_type                    ][historic!=archaeological_site],
103*[artwork_type                 ][tourism!=artwork],
104*[castle_type                  ][historic!=castle],
105*[reservoir_type               ][landuse!=reservoir][water!=reservoir],
106*[bridge:movable               ][bridge!=movable],
107*[parking                      ][amenity!~/^(parking|parking_space|parking_entrance|motorcycle_parking)$/],
108*[cutline                      ][man_made!=cutline],
109*[bunker_type                  ][military!=bunker] {
110  throwWarning: tr("{0} without {1}", "{0.key}", "{1.tag}");
111}
112
113/* {0.tag} without {1.key} (warning level) */
114*[tourism=information][!information],
115*[aeroway=terminal][!building],
116*[power=generator][!generator:source],
117*[amenity=place_of_worship][!religion] {
118  throwWarning: tr("{0} without {1}", "{0.tag}", "{1.key}");
119}
120
121/* {0.tag} without {1.key} (info level) */
122*[amenity=parking              ][!parking],
123*[amenity=parking_entrance     ][!parking] {
124  throwOther: tr("{0} without {1}", "{0.tag}", "{1.key}");
125}
126
127/* {0.key} without {1.key} or {2.key} */
128*[incline                      ][!highway][!railway],
129*[oneway                       ][!highway][!railway] {
130  throwWarning: tr("{0} without {1} or {2}", "{0.key}", "{1.key}", "{2.key}");
131}
132
133/* {0.key} without {1.key} or {2.tag} */
134*[smoothness                   ][!highway][amenity!~/^(parking|parking_space|parking_entrance|motorcycle_parking)$/],
135*[segregated                   ][!highway][railway!=crossing] {
136  throwWarning: tr("{0} without {1} or {2}", "{0.key}", "{1.key}", "{2.tag}");
137}
138
139/* {0.tag} without {1.tag} (info level) see #11600 #11393 #11850 */
140*[highway=motorway][!oneway][junction!=roundabout],
141*[highway=motorway_link][!oneway][junction!=roundabout] {
142  throwOther: tr("{0} without {1}", "{0.tag}", "{1.tag}");
143}
144
145/* {0.tag} without {1.tag} or {2.tag} */
146*[amenity=recycling][recycling_type!=container][recycling_type!=centre] {
147  throwWarning: tr("{0} without {1} or {2}", "{0.tag}", "{1.tag}", "{2.tag}");
148}
149
150/* {0.key} without {1.key}, {2.tag} or {3.tag} */
151*[intermittent                 ][!waterway][natural!~/^(water|spring)$/][ford!=yes],
152*[boat                         ][!waterway][natural!=water][landuse!=basin] {
153  throwWarning: tr("{0} without {1}, {2} or {3}", "{0.key}", "{1.key}", "{2.tag}", "{3.tag}");
154}
155
156/* {0.key} without {1.key}, {2.key} or {3.key} */
157*[snowplowing                  ][!highway][!amenity][!leisure] {
158  throwWarning: tr("{0} without {1}, {2} or {3}", "{0.key}", "{1.key}", "{2.key}", "{3.key}");
159}
160
161/* {0.key} without {1.key}, {2.key} or {3.tag} */
162*[toll                         ][!highway][!barrier][route!~/^(ferry|road)$/] {
163  throwWarning: tr("{0} without {1}, {2} or {3}", "{0.key}", "{1.key}", "{2.key}", "{3.tag}");
164}
165
166/* {0.tag} together with {1.key}, see #10837 */
167*[noname?][name] {
168  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.key}");
169}
170
171/* {0.tag} together with {1.key}, see #9389, #11977 */
172*[oneway=yes][/:backward/][!"traffic_sign:backward"],
173*[oneway=yes][/:forward/][!"traffic_sign:forward"],
174*[oneway=-1 ][/:backward/][!"traffic_sign:backward"],
175*[oneway=-1 ][/:forward/][!"traffic_sign:forward"] {
176  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.key}");
177}
178
179/* {0.tag} together with {1.tag} (info level), see #9696 */
180*[highway=footway][oneway=no] {
181  throwOther: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
182}
183
184/* {0.tag} together with {1.tag}, see #10186 */
185*[highway=footway][bicycle=designated] {
186  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
187}
188
189/*see #11127*/
190way[waterway][bridge=yes] {
191  throwWarning: tr("{0} together with {1}", "{0.key}", "{1.tag}");
192  suggestAlternative: "bridge=aqueduct";
193  fixAdd: "bridge=aqueduct";
194}
195
196/* only {0.key}, see #11104 */
197*[area][eval(number_of_tags()) = 1],
198*[name][eval(number_of_tags()) = 1],
199*[ref][eval(number_of_tags()) = 1] {
200  throwWarning: tr("incomplete object: only {0}", "{0.key}");
201}
202/* only {0.key} and {1.key}, see #11104 */
203*[name][area][eval(number_of_tags()) = 2],
204*[name][ref][eval(number_of_tags()) = 2] {
205  throwWarning: tr("incomplete object: only {0} and {1}", "{0.key}", "{1.key}");
206}
207
208/* see #9811, #11491 */
209*[place][place!=farm][/^addr:/],
210*[boundary][/^addr:/],
211*[highway][/^addr:/][highway!=services][highway!=rest_area][!"addr:postcode"] {
212  throwWarning: tr("{0} together with addr:*", "{0.key}");
213}
214*[!highway][postal_code]["addr:postcode"][postal_code=*"addr:postcode"] {
215  throwWarning: tr("{0} together with {1}", "{1.key}", "{2.key}");
216}
217*[!highway][postal_code]["addr:postcode"][postal_code!=*"addr:postcode"] {
218  throwWarning: tr("{0} together with {1} and conflicting values", "{1.key}", "{2.key}");
219}
220way[highway][postal_code]["addr:postcode"][postal_code=*"addr:postcode"] {
221  throwWarning: tr("{0} together with {1}", "{1.key}", "{2.key}");
222  fixRemove: "addr:postcode";
223}
224way[highway][postal_code]["addr:postcode"][postal_code!=*"addr:postcode"] {
225  throwWarning: tr("{0} together with {1} and conflicting values", "{1.key}", "{2.key}");
226}
227way[highway][!postal_code]["addr:postcode"] {
228  throwWarning: tr("{0} together with {1}", "{0.key}", "{2.key}");
229  suggestAlternative: "postal_code";
230  fixChangeKey: "addr:postcode=>postal_code";
231}
232
233/* see #9195 */
234*[highway=footway][cycleway=lane] {
235  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
236  suggestAlternative: "highway=path + foot=designated + bicycle=designated + segregated=yes";
237}
238
239/* {0} on suspicious object */
240*[tunnel  ][!highway][!railway][!waterway][public_transport != platform][man_made != pipeline],
241*[bridge  ][!highway][!railway][!waterway][!piste:type][public_transport != platform][man_made !~ /^(bridge|pipeline)$/][building != bridge],
242*[psv     ][!highway][!railway][!waterway][amenity !~ /^parking.*/],
243*[width   ][!highway][!railway][!waterway][!aeroway][!cycleway][!footway][!barrier][!man_made][!entrance],
244*[maxspeed][!highway][!railway][traffic_sign !~ /^((.*;)?maxspeed(;.*)?|[A-Z][A-Z]:.+)$/][type != enforcement][waterway !~ /^(river|canal|lock)$/][!traffic_calming],
245*[lit     ][!highway][!railway][!piste:type][!amenity][public_transport!=platform][advertising!=billboard][!leisure][!tourism] {
246  throwWarning: tr("{0} on suspicious object", "{0.key}");
247}
248
249node[amenity =~ /^(restaurant|cafe|fast_food)$/][!name][noname!=yes] {
250  throwOther: tr("restaurant without name");
251  assertMatch: "node amenity=restaurant";
252  assertNoMatch: "node amenity=restaurant noname=yes";
253  assertNoMatch: "node amenity=restaurant name=Foobar";
254}
255
256way[highway][barrier],
257*[highway][waterway][waterway!=dam][waterway!=weir],
258way[highway][natural],
259*[landuse][building] {
260  throwWarning: tr("{0} used with {1}", "{0.key}", "{1.key}");
261  assertNoMatch: "node highway=street_lamp natural=birds_nest note=josm#10193";
262}
263
264*[natural=water][leisure=swimming_pool],
265*[natural=water][amenity=swimming_pool] {
266  /* see #6932 */
267  throwWarning: tr("natural water used for swimming pool");
268  fixRemove: "natural";
269}
270
271/* see #9593, #11183 */
272*[sport][!building][!club][tourism != hotel][highway != raceway][leisure !~ /^(sports_centre|stadium|track|pitch|golf_course|water_park|swimming_pool|recreation_ground|ice_rink)$/][natural !~ /^(beach|bare_rock|peak|water)$/][amenity !~ /^(pub|restaurant|swimming_pool)$/][landuse !~ /^(recreation_ground|piste|farm|farmland)$/][barrier !~ /^(wall|retaining_wall)$/][!"piste:type"] {
273    throwWarning: tr("sport without physical feature");
274    assertMatch: "node sport=tennis";
275    assertNoMatch: "node sport=tennis leisure=pitch";
276    assertNoMatch: "node sport=beachvolleyball natural=beach";
277    assertNoMatch: "node sport=skiiing landuse=piste";
278    assertNoMatch: "node sport=swimming tourism=hotel";
279    assertNoMatch: "node sport=10pin amenity=restaurant";
280}
281
282/* see #10140 */
283*[building:levels][!building][!building:part] {
284  throwWarning: tr("{0} without {1} or {2}", "{0.key}", "{1.key}", "{2.key}");
285}
286
287/* see #10471 */
288way[waterway] > node[ford?] { set ford_on_waterway; }
289way[highway] > node[ford?] { set ford_on_highway; }
290node[ford?]:in-downloaded-area!.ford_on_waterway, node[ford?]:in-downloaded-area!.ford_on_highway {
291    throwWarning: tr("{0} should be on the node where {1} and {2} intersect", "ford", "highway", "waterway");
292}
293
294/* any other *_name tag (with some exceptions) but not a name , see #10837 #11297 #11539 */
295*[/_name$/][!name][!old_name][!loc_name][!uic_name][!artist_name][!"osak:municipality_name"][!"osak:street_name"][noname!=yes] {
296  throwWarning: tr("alternative name without {0}", "{1.key}");
297}
298
299/* see #10837 */
300way[destination][!oneway?][junction!=roundabout][highway] {
301  throwWarning: tr("incomplete usage of {0} on a way without {1}", "{0.key}", "{1.key}");
302  suggestAlternative: "destination:forward";
303  suggestAlternative: "destination:backward";
304}
305
306/* see #11389 */
307way["maxspeed:forward"=*"maxspeed:backward"][!maxspeed] {
308  throwWarning: tr("Same value of {0} and {1}", "{0.key}", "{1.key}");
309  suggestAlternative: "maxspeed";
310  fixChangeKey: "maxspeed:forward=>maxspeed";
311  fixRemove: "maxspeed:backward";
312}
313way["maxspeed:forward"=*maxspeed]["maxspeed:backward"=*maxspeed][maxspeed] {
314  throwWarning: tr("Same value of {0}, {1} and {2}", "{0.key}", "{1.key}", "{2.key}");
315  set AllSameMaxspeed;
316  suggestAlternative: "maxspeed";
317  fixRemove: "maxspeed:forward";
318  fixRemove: "maxspeed:backward";
319}
320way["maxspeed:forward"]["maxspeed:backward"][maxspeed]!.AllSameMaxspeed {
321  throwWarning: tr("{0} and {1} together with {2} and conflicting values", "{0.key}", "{1.key}", "{2.key}");
322}
323way["maxspeed:forward"][maxspeed][!"maxspeed:backward"],
324way["maxspeed:backward"][maxspeed][!"maxspeed:forward"] {
325  throwWarning: tr("{0} together with {1}", "{0.key}", "{1.key}");
326}
327
328/* see #11837 */
329way[layer][layer<0][bridge][bridge!=no][location!=underground][indoor!=yes][!tunnel],
330way[layer][layer>0][tunnel][tunnel!=no][location!=overground][indoor!=yes][!bridge] {
331  throwWarning: tr("Suspicious tag combination: {0} and {1}", "{2.tag}", "{0.tag}");
332}
Note: See TracBrowser for help on using the repository browser.