<div class="gmail_quote">On Wed, Jul 29, 2009 at 12:26 PM, Ben Supnik <span dir="ltr"><<a href="mailto:bsupnik@xsquawkbox.net">bsupnik@xsquawkbox.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Y'all,<br>
<br>
I am trying to build an algorithm to produce correctly layered,<br>
correctly connected road networks from OSM ways + the layer tag.<br>
<br>
There are a few "easy" cases:<br>
<br>
- When two ways cross laterally but have different layers and have no<br>
node at the intersection, clearly they do not connect in space, and the<br>
layer of each of the four partial ways at the intersection point is clear.<br>
<br>
- When two (and only two) ways end at a common node, and the ways have<br>
different layers, it's probably a safe bet to say that this is where the<br>
layers transition and the two ways should connect.  (E.g. a way with<br>
layer=1 and a way with layer=0 form a highway that has a bridge...this<br>
junction is where the bridge "hits the ground".<br>
<br>
There are two cases I am wondering about though:<br>
<br>
- Two ways cross and have different layers, but a common node exists at<br>
the crossing point.<br>
<br>
- Three ways come together, two of one layer, and one of another layer.<br>
<br>
An example of this last case might be a residential road that is about<br>
to "bridge" over a highway, but the bridge ends at a T junction to<br>
another residential road, e.g.<br>
<br>
----*=====<br>
     |<br>
<br>
(Sorry for the ASCII drawing...)<br>
<br>
These two cases seem tricky to me because there may be some cases where<br>
ways of different layer need to be brought together and some where they<br>
need to be kept separate.<br>
<br>
Does anyone have thoughts (or has anyone implemented) a heuristic to<br>
decide when two ways need to be put into the same layer at a given node?<br>
<br>
Thanks!<br>
Ben<br></blockquote></div><br>The topology rules are simple--if the ways share a node, then they are connected and it is possible to navigate from any of the connected ways to another (subject to turn restrictions, etc.) The layer tag is primarily a hint for renderers for proper display of vertically separated features. If the data is otherwise, then it is an error and should be corrected.<br>
<br>Karl<br>