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

Last change on this file since 10350 was 10350, checked in by Klumbumbus, 7 years ago

fix #12942 - improve oneway warning

  • Property svn:eol-style set to native
File size: 16.7 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][man_made!=pipeline],
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*[transformer                  ][!power],
96*[fence_type                   ][barrier!=fence],
97*[recycling_type               ][amenity!=recycling],
98*[information                  ][tourism!=information],
99*[board_type                   ][information!=board],
100*[shelter_type                 ][amenity!=shelter],
101*[lamp_type                    ][highway!=street_lamp],
102*[map_type                     ][information!=map],
103*[site_type                    ][historic!=archaeological_site],
104*[artwork_type                 ][tourism!=artwork],
105*[castle_type                  ][historic!=castle],
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.key} without {1.tag} or {2.tag} */
114*[substation                   ][power!=substation][pipeline!=substation],
115*[reservoir_type               ][landuse!=reservoir][water!=reservoir] {
116  throwWarning: tr("{0} without {1} or {2}", "{0.key}", "{1.tag}", "{2.tag}");
117}
118
119/* {0.tag} without {1.key} (warning level) */
120relation[route=bicycle][!network][type=route],
121relation[route=hiking][!network][type=route],
122relation[route=foot][!network][type=route],
123relation[route=horse][!network][type=route],
124relation[route=piste][!piste:type][type=route],
125relation[route=ski][!piste:type][type=route],
126*[tourism=information][!information],
127*[aeroway=terminal][!building],
128*[power=generator][!generator:source],
129*[amenity=place_of_worship][!religion] {
130  throwWarning: tr("{0} without {1}", "{0.tag}", "{1.key}");
131}
132
133/* {0.tag} without {1.key} (info level) */
134way[power=cable                ][!location],
135node[power=transformer         ][!voltage],
136way[power=line                 ][!voltage],
137way[power=minor_line           ][!voltage],
138way[power=cable                ][!voltage],
139*[power=generator              ][!voltage][generator:output:electricity],
140*[power=plant                  ][!voltage][plant:output:electricity],
141*[power=substation             ][!substation],
142*[power=transformer            ][!transformer],
143*[amenity=parking              ][!parking],
144*[amenity=parking_entrance     ][!parking] {
145  throwOther: tr("{0} without {1}", "{0.tag}", "{1.key}");
146  assertMatch: "way power=line";
147  assertNoMatch: "way power=line voltage=1";
148  assertNoMatch: "way power=switch";
149  assertMatch: "way power=substation";
150  assertMatch: "way power=substation transformer=foobar";
151  assertNoMatch: "way power=substation substation=foobar";
152  assertMatch: "way power=generator generator:output:electricity=yes";
153  assertNoMatch: "way power=generator";
154  assertNoMatch: "way power=generator generator:output:electricity=yes voltage=1";
155}
156
157/* {0.key} without {1.key} or {2.key} */
158way[oneway][!highway][!railway] {
159  throwWarning: tr("{0} without {1} or {2}", "{0.key}", "{1.key}", "{2.key}");
160}
161
162/* {0.key} without {1.key} or {2.tag} */
163*[smoothness                   ][!highway][amenity!~/^(parking|parking_space|parking_entrance|motorcycle_parking|bicycle_parking)$/],
164*[segregated                   ][!highway][railway!=crossing] {
165  throwWarning: tr("{0} without {1} or {2}", "{0.key}", "{1.key}", "{2.tag}");
166}
167
168/* {0.tag} without {1.tag} (info level) see #11600 #11393 #11850 */
169*[highway=motorway][!oneway][junction!=roundabout],
170*[highway=motorway_link][!oneway][junction!=roundabout] {
171  throwOther: tr("{0} without {1}", "{0.tag}", "{1.tag}");
172}
173
174/* {0.tag} without {1.tag} or {2.tag} */
175*[amenity=recycling][recycling_type!=container][recycling_type!=centre] {
176  throwWarning: tr("{0} without {1} or {2}", "{0.tag}", "{1.tag}", "{2.tag}");
177}
178
179/* {0.key} without {1.key}, {2.tag} or {3.tag} */
180*[intermittent                 ][!waterway][natural!~/^(water|spring)$/][ford!=yes],
181*[boat                         ][!waterway][natural!=water][landuse!=basin] {
182  throwWarning: tr("{0} without {1}, {2} or {3}", "{0.key}", "{1.key}", "{2.tag}", "{3.tag}");
183}
184
185/* {0.key} without {1.key}, {2.key} or {3.key} */
186*[snowplowing                  ][!highway][!amenity][!leisure] {
187  throwWarning: tr("{0} without {1}, {2} or {3}", "{0.key}", "{1.key}", "{2.key}", "{3.key}");
188}
189
190/* {0.key} without {1.key}, {2.key} or {3.tag} */
191*[incline                      ][!highway][!railway][aeroway!~/^(runway|taxiway)$/],
192*[toll                         ][!highway][!barrier][route!~/^(ferry|road)$/] {
193  throwWarning: tr("{0} without {1}, {2} or {3}", "{0.key}", "{1.key}", "{2.key}", "{3.tag}");
194}
195
196/* {0.tag} together with {1.key}, see #10837 */
197*[noname?][name] {
198  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.key}");
199}
200
201/* {0.tag} together with {1.key}, see #9389, #11977 */
202*[oneway=yes][/:backward/][!"traffic_sign:backward"],
203*[oneway=yes][/:forward/][!"traffic_sign:forward"],
204*[oneway=-1 ][/:backward/][!"traffic_sign:backward"],
205*[oneway=-1 ][/:forward/][!"traffic_sign:forward"] {
206  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.key}");
207}
208
209/* {0.tag} together with {1.tag} (info level), see #9696 */
210*[highway=footway][oneway=no] {
211  throwOther: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
212}
213
214/* {0.tag} together with {1.tag}, see #10186 */
215*[highway=footway][bicycle=designated] {
216  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
217}
218
219/* #11127 */
220way[waterway][bridge=yes] {
221  throwWarning: tr("{0} together with {1}", "{0.key}", "{1.tag}");
222  suggestAlternative: "bridge=aqueduct";
223  fixAdd: "bridge=aqueduct";
224}
225
226/* only {0.key}, see #11104 #12422 */
227*[area][eval(number_of_tags()) = 1],
228*[name][eval(number_of_tags()) = 1],
229*[ref][eval(number_of_tags()) = 1],
230*[lit][eval(number_of_tags()) = 1] {
231  throwWarning: tr("incomplete object: only {0}", "{0.key}");
232}
233/* only {0.key} and {1.key}, see #11104 */
234*[name][area][eval(number_of_tags()) = 2],
235*[name][ref][eval(number_of_tags()) = 2] {
236  throwWarning: tr("incomplete object: only {0} and {1}", "{0.key}", "{1.key}");
237}
238
239/* #9811, #11491, #12865 */
240*[place][place!=farm][/^addr:/],
241*[boundary][/^addr:/],
242*[highway][/^addr:/][highway!=services][highway!=rest_area][!"addr:postcode"] {
243  throwWarning: tr("{0} together with addr:*", "{0.key}");
244}
245*[!highway][postal_code]["addr:postcode"][postal_code=*"addr:postcode"] {
246  throwWarning: tr("{0} together with {1}", "{1.key}", "{2.key}");
247}
248*[!highway][postal_code]["addr:postcode"][postal_code!=*"addr:postcode"] {
249  throwWarning: tr("{0} together with {1} and conflicting values", "{1.key}", "{2.key}");
250}
251way[highway][postal_code]["addr:postcode"][postal_code=*"addr:postcode"] {
252  throwWarning: tr("{0} together with {1}", "{1.key}", "{2.key}");
253  fixRemove: "addr:postcode";
254}
255way[highway][postal_code]["addr:postcode"][postal_code!=*"addr:postcode"] {
256  throwWarning: tr("{0} together with {1} and conflicting values", "{1.key}", "{2.key}");
257}
258way[highway][highway!=services][highway!=rest_area][!postal_code]["addr:postcode"] {
259  throwWarning: tr("{0} together with {1}", "{0.key}", "{2.key}");
260  suggestAlternative: "postal_code";
261  fixChangeKey: "addr:postcode=>postal_code";
262}
263
264/* #9195 */
265*[highway=footway][cycleway=lane] {
266  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
267  suggestAlternative: "highway=path + foot=designated + bicycle=designated + segregated=yes";
268}
269
270/* {0} on suspicious object */
271*[tunnel  ][!highway][!railway][!waterway][public_transport != platform][man_made != pipeline],
272*[bridge  ][!highway][!railway][!waterway][!piste:type][public_transport != platform][man_made !~ /^(bridge|pipeline)$/][building != bridge],
273*[psv     ][!highway][!railway][!waterway][amenity !~ /^parking.*/],
274*[width   ][!highway][!railway][!waterway][!aeroway][!cycleway][!footway][!barrier][!man_made][!entrance],
275*[maxspeed][!highway][!railway][traffic_sign !~ /^((.*;)?maxspeed(;.*)?|[A-Z][A-Z]:.+)$/][type != enforcement][waterway !~ /^(river|canal|lock)$/][!traffic_calming] {
276  throwWarning: tr("{0} on suspicious object", "{0.key}");
277}
278
279node[amenity =~ /^(restaurant|cafe|fast_food)$/][!name][noname!=yes] {
280  throwOther: tr("restaurant without name");
281  assertMatch: "node amenity=restaurant";
282  assertNoMatch: "node amenity=restaurant noname=yes";
283  assertNoMatch: "node amenity=restaurant name=Foobar";
284}
285
286way[highway][barrier],
287*[highway][waterway][waterway!=dam][waterway!=weir],
288way[highway][natural],
289*[landuse][building] {
290  throwWarning: tr("{0} used with {1}", "{0.key}", "{1.key}");
291  assertNoMatch: "node highway=street_lamp natural=birds_nest note=josm#10193";
292}
293
294/* #6932 */
295*[natural=water][leisure=swimming_pool],
296*[natural=water][amenity=swimming_pool] {
297  throwWarning: tr("natural water used for swimming pool");
298  fixRemove: "natural";
299}
300
301/* #9593, #11183, #12418, #12761 */
302*[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|cliff|peak|water)$/][amenity !~ /^(pub|restaurant|swimming_pool)$/][landuse !~ /^(recreation_ground|piste|farm|farmland)$/][barrier !~ /^(wall|retaining_wall)$/][!"piste:type"][shop!=sports] {
303    throwWarning: tr("sport without physical feature");
304    assertMatch: "node sport=tennis";
305    assertNoMatch: "node sport=tennis leisure=pitch";
306    assertNoMatch: "node sport=beachvolleyball natural=beach";
307    assertNoMatch: "node sport=skiiing landuse=piste";
308    assertNoMatch: "node sport=swimming tourism=hotel";
309    assertNoMatch: "node sport=10pin amenity=restaurant";
310}
311
312/* #10140 */
313*[building:levels][!building][!building:part] {
314  throwWarning: tr("{0} without {1} or {2}", "{0.key}", "{1.key}", "{2.key}");
315}
316
317/* #10471 */
318way[waterway] > node[ford?] { set ford_on_waterway; }
319way[highway] > node[ford?] { set ford_on_highway; }
320node[ford?]:in-downloaded-area!.ford_on_waterway, node[ford?]:in-downloaded-area!.ford_on_highway {
321    throwWarning: tr("{0} should be on the node where {1} and {2} intersect", "ford", "highway", "waterway");
322}
323
324/* any other *_name tag (with some exceptions) but not a name , see #10837 #11297 #11539 */
325*[/_name$/][!name][!old_name][!loc_name][!uic_name][!artist_name][!"osak:municipality_name"][!"osak:street_name"][noname!=yes] {
326  throwWarning: tr("alternative name without {0}", "{1.key}");
327}
328
329/* #10837 */
330way[destination][!oneway?][junction!=roundabout][highway] {
331  throwWarning: tr("incomplete usage of {0} on a way without {1}", "{0.key}", "{1.key}");
332  suggestAlternative: "destination:forward";
333  suggestAlternative: "destination:backward";
334}
335
336/* #11389 */
337way["maxspeed:forward"=*"maxspeed:backward"][!maxspeed] {
338  throwWarning: tr("Same value of {0} and {1}", "{0.key}", "{1.key}");
339  suggestAlternative: "maxspeed";
340  fixChangeKey: "maxspeed:forward=>maxspeed";
341  fixRemove: "maxspeed:backward";
342}
343way["maxspeed:forward"=*maxspeed]["maxspeed:backward"=*maxspeed][maxspeed] {
344  throwWarning: tr("Same value of {0}, {1} and {2}", "{0.key}", "{1.key}", "{2.key}");
345  set AllSameMaxspeed;
346  suggestAlternative: "maxspeed";
347  fixRemove: "maxspeed:forward";
348  fixRemove: "maxspeed:backward";
349}
350way["maxspeed:forward"]["maxspeed:backward"][maxspeed]!.AllSameMaxspeed {
351  throwWarning: tr("{0} and {1} together with {2} and conflicting values", "{0.key}", "{1.key}", "{2.key}");
352}
353way["maxspeed:forward"][maxspeed][!"maxspeed:backward"],
354way["maxspeed:backward"][maxspeed][!"maxspeed:forward"] {
355  throwWarning: tr("{0} together with {1}", "{0.key}", "{1.key}");
356}
357
358/* #11837 */
359way[layer][layer<0][bridge][bridge!=no][location!=underground][indoor!=yes][!tunnel],
360way[layer][layer>0][tunnel][tunnel!=no][location!=overground][indoor!=yes][!bridge] {
361  throwWarning: tr("Suspicious tag combination: {0} and {1}", "{2.tag}", "{0.tag}");
362}
363
364/* #12942 */
365relation[oneway][type!=route] {
366  throwWarning: tr("{0} on a relation without {1}", "{0.key}", "{1.tag}");
367}
Note: See TracBrowser for help on using the repository browser.