I’m using .OSM files to build 3D cities.
I’m trying to render crossroads. Parsing the xml files, I saw different derscriptions of way’s xml elements, when 2 different streets overlap at a given point.
First way and second way are defined by 2 nodes. The two way share a xml node where the 2 streets intersect.
First way and second way are defined by 2 nodes, but none of the nodes is shared between them.
First way and second way are described both using 2 elements (4 total nodes involved). The 4 way shares the same xml node.
I don’t know if there are more possibility.
I’m particularly worried about the second case, because the algorithm I’m developing for the 3D mesh generation, requires to know if a given node is shader between more ways.
So my question is the following:
Is there any reference or documentation, explaining how a correct xml file would represent 2 crossing roads?
Are the 3(or more) cases illustrated before always possible?Or maybe the xml where two overlapping roads don’t share a node is wrong?
The second case is an error in the data. It is not expected that applications can deal with it and instances of this should be fixed in the OSM database instead. If two roads connect in reality, the ways representing them are supposed to have a common node. Ways with highway=* tags should only intersect without a node if one of them represents a bridge or tunnel on a different layer, i.e. there is no physical connection.
Case 1 and 3 are indeed both possible and correct. Ideally, they should not cause your application to behave visibly differently unless the separate ways in case 3 have different relevant tags. A combination of case 1 and 3 is also possible: Some of the ways might continue through the common node, and others end at the same common node.
You can change the subject line by editing your first post. Just adding something like “[solved]” there should be enough to let users browsing the thread list skip it. To be honest, though, it’s not really common practice here to close threads at all - most users don’t bother.