gravitystorm/openstreetmap-carto — pull request #356 by math1985 (2014-02-24 01:55:37+00:00)
Title: Unify road definitions for bridges, tunnels, and normal roads

Code for every highway type is currently spread out over three places in the code: once for bridges, once for tunnels, and once for normal roads. This means that a lot of code is duplicated. The current pull request brings the code for a single highway type together at one place in the code.

Although the code is brought together, it does not yet collapse all equivalent definitions. This will be done in the next pull request.

The advantage of this is easier maintenance, because a) the CartoCSS code will be shorter; b) there will be less duplication in the code; and c) code for one type of road is at only one location in the code.

Changes
-------
Although the aim of this change is to improve the structure of the code, it has some small changes of rendering as side effects:
- The tag access=no is no longer rendered on railways, aeroways, and roads under construction.
- For bridges and tunnels, access restrictions are rendered at the same time as the roads to which they apply, just like it was already the case for normal roads.
- Direction arrows are now layered as own attachment, but still directly on top of the layer they apply to.
- Tunnels and bridges that are a link are now rendered under other roads of the same osm-layer, just like links that are not a tunnel or bridge.
- The following kind of tunnels are now correctly rendered in the tunnel layer instead of in the regular layer: the highway types tertiary (z10-12), residential (z10-12), unclassified (z10-12), service,
living_street, road (fill only), road (z10-12), pedestrian, platform, steps, track, raceway, construction, proposed; all railway types; all aeroway types.
- The following kind of bridges are now correctly rendered in the bridge layer instead of in the regular layer: the highway types secondary (z12), tertiary (z10-13), unclassified (z10-13), residential (z10-13), road (z10-13), living_street, pedestrian (z13-15), bridleway (z13), footway (z13), cycleway (z13), path (z13), track (z13), raceway, construction, platform, steps; the railway types spur (z11-12), siding (z11-12), yard (z11-12), funicular, minitiature, tram, lightrail (z13), subway (z12-13), preserved, monorail, platform, turntable; the aeroway type runway (z11-13).
- Ways with both tunnel=yes and bridge=yes might get rendered different than before (but such ways should not exist anyway).
- highway=road is now also rendered on the layer for bridges and tunnels.
- One-way restrictions on bridges are no longer displayed on highways types that are not rendered.
- One-way restrictions on bridges are now displayed on all rendered railway types.

Performance
-----------
In general performance seems to improve. I compared performance between 2254ec971ca418e34295c67417febf003c5182cc and 42e4203f2fd9a40e9732b59db0a97506e399ec96. The resulting output osm.xml is now 8% smaller. I measure a performance loss of 4% at z15, but performance gains of 12%, 16%, and 13% on z16, z17, and z18, respectively. My measurements are not very accurate, so I would be happy if @pnormal or someone else could independently verify this.

Pull request size
-----------------
I'm sorry for the huge pull request. I couldn't break it up without breaking functionality or significantly increasing run-time. I'm also sorry that it is based on a rather old revision (it took me some time). The next pull requests will be smaller, and will be based on the current master again.