source: josm/trunk/resources/data/validator/geometry.mapcss

Last change on this file was 18921, checked in by taylor.smock, 4 months ago

Fix #23308: Fix a false positive for "Water area inside water area" validation (patch by gaben, modified)

A coastline as an area follows the right-side rule like coastlines as a way.
This means that a water area inside the area, as defined for almost every other
area tag, may be valid, depending upon the directionality of the coastline way.

Modifications are as follows:

  • Look for water areas inside oceans (coastline is drawn in clockwise direction)
    • This is anticipated to be a rare occurrence since most coastlines are expected to be part of a large area.
  • Add non-regression test
  • Keep previous spacing for easier svn blame usage
  • Property svn:eol-style set to native
File size: 16.1 KB
Line 
1/* {0} on a node, should be a way */
2node[area=no],
3node[oneway],
4node[bridge],
5node[sidewalk],
6node[footway][footway!=crossing], /* footway=crossing has own warning in highway.mapcss */
7node[man_made=embankment],
8node[man_made=groyne],
9node[man_made=cutline],
10node[power=line],
11node[cutline],
12node[aerialway=cable_car],
13node[aerialway=gondola],
14node[aerialway=chair_lift],
15node[aerialway=mixed_lift],
16node[aerialway=drag_lift],
17node[aerialway=t-bar],
18node[aerialway=j-bar],
19node[aerialway=platter],
20node[aerialway=magic_carpet],
21node[aerialway=rope_tow],
22node[aerialway=goods],
23node[aeroway=taxiway],
24node[aeroway=runway],
25node[railway=rail],
26node[railway=narrow_gauge],
27node[railway=monorail],
28node[railway=preserved],
29node[railway=light_rail],
30node[railway=subway],
31node[railway=tram],
32node[railway=disused],
33node[railway=abandoned],
34node[waterway=river],
35node[waterway=canal],
36node[waterway=stream],
37node[waterway=ditch],
38node[waterway=drain],
39node[natural=coastline],
40node[natural=ridge],
41node[natural=valley],
42node[natural=tree_row] {
43 throwWarning: tr("{0} on a node. Should be used on a way.", "{0.tag}");
44 assertMatch: "node oneway=-1";
45 assertNoMatch: "way oneway=-1";
46 assertMatch: "node bridge=yes";
47 assertMatch: "node bridge=viaduct";
48}
49
50/* {0} on a node, should be a way or relation */
51node[boundary=administrative] {
52 throwWarning: tr("{0} on a node. Should be used on a way or relation.", "{0.tag}");
53}
54
55/* {0} on a node, should be an area; #10679 #16528 #16792 #12502 #17402*/
56node[golf=green],
57node[golf=bunker],
58node[golf=fairway],
59node[area=yes],
60node[area:highway],
61node[landuse],
62node[natural=bare_rock],
63node[natural=beach],
64node[natural=fell],
65node[natural=glacier],
66node[natural=grassland],
67node[natural=heath],
68node[natural=mud],
69node[natural=sand],
70node[natural=scree],
71node[natural=scrub],
72node[natural=shrubbery],
73node[natural=water],
74node[natural=wetland],
75node[natural=wood],
76node[leisure=park][natural!=tree], /* For nodes with both tags another warning is created in combinations.mapcss */
77node[leisure=nature_reserve],
78node[waterway=riverbank],
79node[man_made=bridge],
80node[man_made=breakwater],
81node[aeroway=apron],
82node[power=plant],
83node[power=switchgear],
84node[building:part],
85node[source:outline] {
86 throwWarning: tr("{0} on a node. Should be drawn as an area.", "{0.tag}");
87}
88
89/* {0} on a node, should be a relation; Error level; #10252, #10769, #14288 */
90node[type=multipolygon],
91node[interval],
92node[route],
93node[restriction] {
94 throwError: tr("{0} on a node. Should be used in a relation", "{0.tag}");
95}
96
97/* {0} on a way, should be a node (0.tag) */
98way[emergency=fire_hydrant],
99way[emergency=defibrillator],
100way[railway=subway_entrance],
101way[man_made=survey_point],
102way[power=transformer],
103way[power=pole],
104way[power=catenary_mast],
105way[power=connection],
106way[power=terminal],
107way[power=tower]!:closed,
108way[amenity=vending_machine],
109way[natural=peak],
110way[natural=saddle],
111way[natural=volcano],
112way[natural=tree],
113way[highway=give_way],
114way[highway=milestone],
115way[highway=mini_roundabout],
116way[highway=stop],
117way[highway=street_lamp],
118way[highway=traffic_signals],
119way[highway=turning_loop],
120way[highway=turning_circle],
121way[highway=motorway_junction] {
122 throwWarning: tr("{0} on a way. Should be used on a node.", "{0.tag}");
123}
124
125/* {0} on a way, should be a node (0.key) */
126way[voltage:primary],
127way[voltage:secondary],
128way[voltage:tertiary],
129way[transformer],
130way[line_arrangement],
131way[line_attachment],
132way[line_management],
133way[entrance],
134way[door] {
135 throwWarning: tr("{0} on a way. Should be used on a node.", "{0.key}");
136}
137
138/* {0} on a way, should be a relation; #15642, #10252, #14288 */
139way[restriction][restriction =~ /^(no_right_turn|no_left_turn|no_u_turn|no_straight_on|only_right_turn|only_left_turn|only_straight_on|no_entry|no_exit)$/],
140way[type=multipolygon],
141way[interval][route!=ferry],
142way[route=bus] {
143 throwError: tr("{0} on a way. Should be used in a relation", "{0.tag}");
144}
145
146/* {0} on a closed way, should be a unclosed way; #19981 */
147way:closed[power=line] {
148 throwWarning: tr("{0} on a closed way. Should be used on an unclosed way.", "{1.tag}");
149}
150
151/* #20902 */
152relation[area?] {
153 throwWarning: tr("{0} on a relation", "{0.key}");
154 fixRemove: "{0.key}";
155}
156
157/* #14395, #17025, #19506 */
158way[highway][area!=yes][!tunnel][!covered] > node {
159 set node_in_highway;
160}
161way[highway][area!=yes][!tunnel][!covered]:closed > node {
162 set node_in_closed_highway;
163}
164way[highway][area!=yes][!tunnel][!covered] >[index=1] node,
165way[highway][area!=yes][!tunnel][!covered] >[index=-1] node {
166 set first_last_highway_node;
167}
168way[building][building!=no] > node[!entrance].node_in_closed_highway {
169 set node_connects_highway_and_building; /* avoids duplicate warnings with following rule */
170 throwWarning: tr("node connects highway and building");
171}
172way[building][building!=no] > node[!entrance].node_in_highway!.first_last_highway_node!.node_connects_highway_and_building {
173 throwWarning: tr("node connects highway and building");
174}
175
176/* #15035, must not warn for node 3815077900*/
177node[man_made!=monitoring_station][at(0.0,0.0)] {
178 throwError: tr("Object at Position 0.00E 0.00N. There is nothing at this position except an already mapped weather buoy.");
179 fixDeleteObject: this;
180}
181
182/* #10125 */
183node[source:geometry] {
184 throwWarning: tr("{0} on a node", "{0.key}");
185 fixChangeKey: "source:geometry => source:position";
186}
187
188/* Building inside building (spatial test) */
189*[building][building!~/no|entrance/][any(tag("layer"),"0") = any(parent_tag("layer"),"0")]
190area[building][building!~/no|entrance/] {
191 throwWarning: tr("Building inside building");
192}
193
194/* Building overlapping building or building:part (spatial test) */
195area[building][building!~/no|entrance/] area[building:part][building:part!~/no|entrance/],
196area[building][building!~/no|entrance/] area[building][building!~/no|entrance/] {
197 throwWarning: tr("Overlapping buildings");
198}
199
200/* Overlapping areas (spatial test) */
201area[natural =~ /^(water|wetland)$/],
202area[natural=coastline]:clockwise,
203area[waterway=riverbank],
204area[landuse=reservoir] {
205 set water_area;
206}
207
208/* area:closed.water_area ⧉ area:closed.water_area -- does not work for now -- see ticket#10215 */
209area:closed[natural =~ /^(water|wetland|coastline)$/] area:closed.water_area,
210area:closed[waterway=riverbank] area:closed.water_area,
211area:closed[landuse=reservoir] area:closed.water_area {
212 throwWarning: tr("Overlapping Water Areas");
213}
214
215/* Water area inside water area (spatial test) */
216area:closed[natural =~ /^(water|wetland)$/] area:closed.water_area,
217area:closed[natural=coastline]:clockwise area:closed.water_area,
218area:closed[waterway=riverbank] area:closed.water_area,
219area:closed[landuse=reservoir] area:closed.water_area,
220area:closed[natural =~ /^(water|wetland)$/] area:closed.water_area,
221area:closed[natural=coastline]:clockwise area:closed.water_area,
222area:closed[waterway=riverbank] area:closed.water_area,
223area:closed[landuse=reservoir] area:closed.water_area {
224 throwWarning: tr("Water area inside water area");
225}
226
227area:completely_downloaded:closed:areaStyle area:completely_downloaded:closed:areaStyle {
228 throwOther: tr("Overlapping Areas");
229}
230
231/* #9311 */
232node[amenity=parking]["capacity:disabled" !~ /^(yes|[0-9]+)$/] area[amenity=parking] {
233 throwWarning: tr("{0} inside {1}", "amenity=parking", "amenity=parking");
234 group: tr("{0} inside {1}", "amenity", "amenity");
235}
236
237/* #9556, #20570 */
238area:closed:areaStyle[tag("natural") = parent_tag("natural")] area:closed:areaStyle[natural][natural !~ /^(water|wetland|coastline)$/] {
239 throwWarning: tr("Overlapping Identical Natural Areas");
240}
241
242area:closed[tag("landuse") = parent_tag("landuse")] area:closed[landuse] {
243 throwWarning: tr("Overlapping Identical Landuses");
244}
245
246/* #9522 */
247node[tag("amenity") = parent_tag("amenity")] area[amenity][amenity != parking] {
248 throwWarning: tr("{0} inside {1}", concat("amenity=", tag("amenity")), concat("amenity=", tag("amenity")));
249 group: tr("{0} inside {1}", "amenity", "amenity");
250}
251node[tag("leisure") = parent_tag("leisure")] area[leisure] {
252 throwWarning: tr("{0} inside {1}", concat("leisure=", tag("leisure")), concat("leisure=", tag("leisure")));
253 group: tr("{0} inside {1}", "leisure", "leisure");
254}
255node[tag("tourism") = parent_tag("tourism")] area[tourism] {
256 throwWarning: tr("{0} inside {1}", concat("tourism=", tag("tourism")), concat("tourism=", tag("tourism")));
257 group: tr("{0} inside {1}", "tourism", "tourism");
258}
259node[tag("shop") = parent_tag("shop")] area[shop] {
260 throwWarning: tr("{0} inside {1}", concat("shop=", tag("shop")), concat("shop=", tag("shop")));
261 group: tr("{0} inside {1}", "shop", "shop");
262}
263node[tag("power") = parent_tag("power")] area[power] {
264 throwWarning: tr("{0} inside {1}", concat("power=", tag("power")), concat("power=", tag("power")));
265 group: tr("{0} inside {1}", "power", "power");
266}
267
268/* isolated nodes which should be part of a way; #10825, #15478, #21688 */
269node:unconnected:in-downloaded-area[entrance],
270node:unconnected:in-downloaded-area[traffic_calming],
271node:unconnected:in-downloaded-area[highway=passing_place],
272node:unconnected:in-downloaded-area[highway=mini_roundabout],
273node:unconnected:in-downloaded-area[highway=motorway_junction],
274node:unconnected:in-downloaded-area[highway=turning_loop],
275node:unconnected:in-downloaded-area[highway=turning_circle],
276node:unconnected:in-downloaded-area[highway=stop],
277node:unconnected:in-downloaded-area[highway=give_way],
278node:unconnected:in-downloaded-area[highway=traffic_signals],
279node:unconnected:in-downloaded-area[highway=crossing],
280node:unconnected:in-downloaded-area[crossing],
281node:unconnected:in-downloaded-area[railway=buffer_stop],
282node:unconnected:in-downloaded-area[railway=crossing],
283node:unconnected:in-downloaded-area[railway=level_crossing],
284node:unconnected:in-downloaded-area[railway=milestone],
285node:unconnected:in-downloaded-area[railway=railway_crossing],
286node:unconnected:in-downloaded-area[railway=switch],
287node:unconnected:in-downloaded-area[public_transport=stop_position],
288node:unconnected:in-downloaded-area[aeroway=holding_position],
289node:unconnected:in-downloaded-area[noexit],
290node:unconnected:in-downloaded-area[waterway=dam],
291node:unconnected:in-downloaded-area[waterway=weir],
292node:unconnected:in-downloaded-area[waterway=waterfall],
293node:unconnected:in-downloaded-area[amenity=ferry_terminal],
294node:unconnected:in-downloaded-area[leisure=slipway],
295node:unconnected:in-downloaded-area[mountain_pass=yes],
296node:unconnected:in-downloaded-area[barrier=gate],
297node:unconnected:in-downloaded-area[barrier=lift_gate],
298node:unconnected:in-downloaded-area[barrier=swing_gate],
299node:unconnected:in-downloaded-area[barrier=toll_booth],
300node:unconnected:in-downloaded-area[barrier=turnstile],
301node:unconnected:in-downloaded-area[barrier=full-height_turnstile],
302node:unconnected:in-downloaded-area[barrier=motorcycle_barrier],
303node:unconnected:in-downloaded-area[barrier=rope],
304node:unconnected:in-downloaded-area[barrier=sally_port],
305node:unconnected:in-downloaded-area[barrier=spikes],
306node:unconnected:in-downloaded-area[barrier=stile],
307node:unconnected:in-downloaded-area[barrier=sump_buster],
308node:unconnected:in-downloaded-area[barrier=kerb],
309node:unconnected:in-downloaded-area[barrier=border_control],
310node:unconnected:in-downloaded-area[barrier=bump_gate],
311node:unconnected:in-downloaded-area[barrier=bus_trap],
312node:unconnected:in-downloaded-area[barrier=cattle_grid],
313node:unconnected:in-downloaded-area[barrier=chain],
314node:unconnected:in-downloaded-area[barrier=cycle_barrier],
315node:unconnected:in-downloaded-area[barrier=hampshire_gate],
316node:unconnected:in-downloaded-area[barrier=height_restrictor],
317node:unconnected:in-downloaded-area[barrier=debris] {
318 throwWarning: tr("{0}", "{2.tag}");
319 group: tr("isolated node which must be connected to a way");
320}
321
322/* #11127 */
323way[railway][bridge] > node,
324way[highway][bridge] > node {
325 set node_in_bridge;
326}
327way[waterway] > node.node_in_bridge {
328 throwWarning: tr("node connects waterway and bridge");
329}
330
331/* #11128, #14812, #15032 */
332way[highway] > node[tourism=information][information=guidepost] {
333 set guidepost;
334 throwOther: tr("{0} node connected to a highway", "{1.tag}");
335}
336way >[index=1] node,
337way >[index=-1] node {
338 set first_last_node;
339}
340way[highway] > node[amenity][!entrance][amenity!~/^(parking|parking_space|parking_entrance|motorcycle_parking|bicycle_parking|bus_station|car_wash|ferry_terminal|weighbridge|taxi|toilets|ticket_validator)$/],
341way[highway] > node[building][!entrance],
342way[highway] > node[leisure][!entrance][leisure!=slipway][leisure!=fitness_station],
343way[highway] > node[office][!entrance],
344way[highway][highway!=corridor] > node[shop][!entrance],
345way[highway] > node[tourism][!entrance][tourism!=viewpoint]!.guidepost.first_last_node:connection,
346way[highway] > node[tourism][!entrance][tourism!=viewpoint]!.guidepost!.first_last_node {
347 throwWarning: tr("{0} node connected to a highway", "{0.key}");
348}
349
350/* #18817 */
351way[man_made=pipeline][location=underground] > node[marker],
352way[power=cable ][location=underground] > node[marker] {
353 throwWarning: tr("{0} node connected to an underground object", "{0.key}");
354}
355
356way[junction=roundabout]:righthandtraffic:clockwise,
357way[junction=roundabout]!:righthandtraffic:anticlockwise {
358 throwWarning: tr("suspicious roundabout direction");
359}
360
361/* #12496 */
362area:closed[place=islet][eval(areasize()) > 1500000] {
363 throwWarning: tr("{0} on a large area", "{1.tag}");
364 suggestAlternative: "place=island";
365 fixAdd: "place=island";
366}
367
368area:closed[place=island][eval(areasize()) < 500000] {
369 throwWarning: tr("{0} on a small area", "{1.tag}");
370 suggestAlternative: "place=islet";
371 fixAdd: "place=islet";
372}
373
374/* #12561 - building larger than Lada car factory (906280 m^2 in OSM) way id 47121317 at N53.56, E49.25, https://en.wikipedia.org/wiki/List_of_largest_buildings#Largest_footprint*/
375area:closed[building][building!=no][eval(areasize()) > 920000] {
376 throwError: tr("Too large building");
377}
378
379/* #12646, #12992, #16334 */
380way[waterway=~/^(stream|river|drain)$/]!:closed >[index=-1] node[natural!=sinkhole][natural!=cave_entrance][waterway!=stream_end]!:connection:in-downloaded-area {
381 throwWarning: tr("Waterway ends without a connection to another waterway or the direction of the waterway is wrong.");
382}
383
384/* #10717, #14535 */
385way:closed[natural=coastline] area[natural=water],
386way:closed[natural=coastline] area[waterway=riverbank] {
387 throwError: tr("Coastline inside {1}", "{0.tag}");
388}
389
390/* #10471 */
391way[waterway] > node[ford?] { set ford_on_waterway; }
392way[highway] > node[ford?] { set ford_on_highway; }
393node[ford?]:in-downloaded-area!.ford_on_waterway, node[ford?]:in-downloaded-area!.ford_on_highway {
394 throwWarning: tr("{0} should be on the node where {1} and {2} intersect", "ford", "highway", "waterway");
395}
396
397/* #13877 */
398area:closed[waterway = canal][area!=no],
399area:closed[waterway = drain][area!=no],
400area:closed[waterway = ditch][area!=no],
401area:closed[waterway = stream][area!=no],
402area:closed[waterway = river][area!=no] {
403 throwWarning: tr("{0} is the tag for the linear waterway. To tag the water area use {1} + {2} instead.", "{1.tag}", "natural=water", "water=*");
404}
405
406/* #15097 */
407way[highway][area!=yes] > node,
408way[man_made=pier] > node {
409 set node_in_highway_pier;
410}
411way[route=ferry][tunnel=yes] > node,
412way[route=ferry][bridge=yes] > node {
413 set node_in_ferry_bridge_tunnel;
414}
415way[route=ferry]!:closed >[index= 1] node!.node_in_highway_pier!.node_in_ferry_bridge_tunnel:in-downloaded-area,
416way[route=ferry]!:closed >[index=-1] node!.node_in_highway_pier!.node_in_ferry_bridge_tunnel:in-downloaded-area {
417 throwWarning: tr("Ferry route is not connected to the road network or branches.");
418}
419way[amenity=ferry_terminal] > node,
420way[man_made=pier] > node {
421 set node_in_terminal_pier;
422}
423way[route=ferry]!:closed >[index= 1] node[amenity!=ferry_terminal][man_made!=pier]!.node_in_terminal_pier!.node_in_ferry_bridge_tunnel:in-downloaded-area,
424way[route=ferry]!:closed >[index=-1] node[amenity!=ferry_terminal][man_made!=pier]!.node_in_terminal_pier!.node_in_ferry_bridge_tunnel:in-downloaded-area {
425 throwWarning: tr("Ferry route is not connected to a ferry terminal or branches.");
426}
Note: See TracBrowser for help on using the repository browser.