[Talk-us] script for adding layer=1 to bridges

Alan Mintz Alan_Mintz+OSM at Earthlink.Net
Wed Jan 27 07:08:51 GMT 2010

At 2010-01-26 21:58, dion_dock at comcast.net wrote:
>I've noticed that a lot of bridges don't include a layer= tag.  I suspect 
>this is because they render OK in mapnik...but not so well with 
>osmarenderer.  (Consider the railroad in 
>I've spent a little time working on a script that would add a layer=1 tag 
>to any way that has a bridge=yes tag but no layer tag.

This may not be correct to do. Consider the case where a bridge is at level 
0, crossing a waterway that is at level -1. This is quite common in my 
area, where I typically see flood control channels that are sunken below 
street level. Bridges are tagged in the roadways that cross them for 
completeness, and to add state bridge numbers in some cases, but they are 
still at layer 0, just like the streets.

Worse might be a case where there is a freeway overpass over such a 
structure, where the drain is at -1, the bridge carrying the street is 
currently at 0, and the existing overpass is at layer 1. Raising the bridge 
to layer 1 will incorrectly place it at the same level as the overpass.

If you want to do this, I think you have to employ the same logic used in 
the validator, looking at crossing objects, and elevate only those bridges 
that require it, making sure that you elevate anything that is above them, 
ad infinitum. I still don't think it is a great idea to automatically raise 
a bridge that is carrying a roadway at grade, implying a change in elevation.

I realize that layers are supposed to be relative, but I've found that if I 
make them absolute when possible, I don't accidentally break things when 
adding new features.

Alan Mintz <Alan_Mintz+OSM at Earthlink.net>

More information about the Talk-us mailing list