﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
18861	"relations with rings intersecting on isolated nodes (the ""intersection"" is incorrectly signaled)"	verdyp@…	verdyp@…	"this is an old bug in JOSM validator (see the snapshot)

Relations with this example form:

{{{
  A                    B
  +---------------------+
  |                     |
  |                     |
  |                     |
  |                     | C
  +---------------------+------------------+ E
  D                     |                  |
                        |                  |
                        |                  |
                        |                  |
                      G +------------------+ F
}}}

are correctly represented with a multipolygon or boundary relation having the following ""outer"" member ways (note the direction of drawingf each way does not matter, they can be inverted):
* 1st ring:
  - A to B
  - B to C
  - C to D
  - D to A
* 2nd ring:
  - C to E
  - E to F
  - F to G
  - G to C

The problem is that the validator incorrectly reports an intersection, even though the two rings only intersect on an area which as a null area

Another possible representation would be to order them as a single ring (but this is not possible when there are more than one ""touching"" nodes and no ring can be qualified as ""inner"" touching the larger outer ring (such case occurs in some un municipalities of Spain and on the bordzer between Belgium and the Netherlands and for one municipality in the suburbs of Paris, it also occurs for other kind of objects like landuse=* but this warning can be solved by creating separate relations; something impossible to satisfy for administrative borders that cannot be splitted this way), but this situation is not recommended and in fact impossible to satisfy everywhere (e.g. the NE and SW rectangles in the shcema above also belong to the same area modeled in other OSM relation: it's impossibler to decide that the intersection node belongs to one surface or another, it belongs to both).

* single ring:
  - A to B
  - B to C
  - C to E
  - E to F
  - F to G
  - G to C
  - C to D
  - D to A

(this doesnot change at all the number of members, only their relative order in the relation, but order of ways in multipolygons and borders in normally not significant)

A real intersection should be signaled if the intersections of rings on one node (explicitly drawn or not with a node object in OSM) do not cross each other, notably if a valid ring can be connected while keeping all other rings on the same side, even if they have a common node.

So it is valid for a relation to have positions on rings connected to more than 2 ways, but any intersection should be at an isolated node, and the relation is valid *if and only if*:
- all ways connected to that node are starting/ending on that node, 
- the number of ways starting/ending to that node is *even* (2, 4, 6...),
- and the ways do not intererect anywhere else in the middle, i.e. the segments are starting or ending in different angular directions and not colinear (some ways may still intersect on multiple distinct isolated nodes, all of theses nodes being terminal in these ways).
- and there's no other intersection anywhere else (no colinear pair of segments), no pair of non-colinear segments interecting inside or at end of another (if this ever happens on a single closed way, that closed way should be transformed into a relation, and satisfying rings should be determined, by splitting this way and from any pair of colinear segments the common parts with non-zero length, possibly by splitting these segments on the nodes terminating the common parts, so this should be signaled by the validator)

For now (and since long in JOSM) the detection of ""self-intersection"" is wrong and gives false positive detections.

"	defect	closed	normal		Core validator		needinfo		Klumbumbus
