I have created map tiles for an overlay that highlights cycling restrictions, such as bicycle=no, bicycle=use_sidepath, motorroad=yes and so on in different colours.
In my region, it is quite common for cycling to be forbidden only in one direction of a road. This is commonly mapped as bicycle:forward=* and bicycle:backward=*. I am thinking of a way to display this on my map tiles.
My thought is that if the forward and backward restrictions differ, I would render the road as two lines, where one side would be coloured to represent the forward restrictions and the other to represent the backward restrictions. I have a vague idea how to achieve this with CartoCSS: Using attachments or instances, I can render the feature as two lines instead of one, and using line-offset, I can move one of those lines to the left and the other to the right.
The big challenge that I don’t know how to solve is the driving side. The side of the road where you would actually cycle should represent the restrictions in that direction, so the handling of the forward/backward attributes would be flipped depending on whether the road uses left-hand or right-hand traffic. I imagine I would have to determine the driving side in the osm2pgsql flex output Lua script and store it for each way.
It seems like the driving side is stored as the driving_side tag on the country/region boundary relation where it applies. Only in exceptional cases where the driving side differs from the one used in the region is this tag applied to a way itself. So what approaches are there to determine the driving side when processing a way in osm2pgsql?
Are there alternative approaches how directional attributes can be rendered?
