Wednesday, 5 February 2020

symbology - Can I change the precedence when combining "Control feature rendering order" with QGIS symbol levels?


I'm trying to produce a QGIS map style / symbology for processed data. For roads, I'd like to mimic how the OpenStreetMap web tile map "Standard" rendering style (produced with AFAIK) treats road intersections, road bridges over roads, road intersections on bridges and road bridges over road bridges etc.


Example of pedestrian crossings on bridge in OpenStreetMap default style: Bucheggplatz


Example of Y-intersections on bridges in OpenStreetMap default style: northern portal of Milchbucktunnelcontinuation of map: northern portal of Milchbucktunnel
bridges over bridges in OpenStreetMap default style: northern portal of Milchbucktunnelbridges over bridges in OpenStreetMap default style: northern portal of Milchbucktunnel

Map tiles © OpenStreetMap contributors (CC BY-SA 2.0)


To produce the dark rim, I use the same trick as the "Standard" style: Draw a wide dark line and above it a bright line with slightly smaller width for the "interior" of the road. This looks alright for individual road features. To get continuation of roads (which might be split over several features in the data) and road intersections to look right, I can put all "interior" parts of these multi-level line symbols on a higher "Symbol level" (later rendering pass) than all the "rim" parts.


This is also suggested in the QGIS Training Manual. See their solution:
screenshot CC BY-SA 3.0 QGIS project



To get bridges on various levels drawn correctly over each other and over roads, I check "Control feature rendering order" and let it order by the z_order attribute as produced by (cf. Applying OSM z-order after osm2pgsql with qgis). This works fine without the rim, but without the rim you can only really visually see the bridges when they are between roads of different type (which I symbolized in QGIS with different colors). For roads of the same type, the rim is needed to distinguish bridges from intersections.


Combining "Control feature rendering order" with "Symbol levels" gives a wrong-looking result, though. It seems that "Symbol levels" rendering passes take precedence over the feature rendering order: Bridges over roads start to look like intersections when all "interiors" are on a later rendering pass than all "rims": QGIS: symbol level values for rendering all road interiors over all road edges QGIS: all interiors over all rims - bridge crossing road looks like intersection


OSM standard style for comparison:



Map tiles © OpenStreetMap contributors (CC BY-SA 2.0)


This can be fixed by putting both, bridge interiors and bridge rims on a later pass than non-bridge road interiors. But bridges over bridges will then still look wrong, as will intersections on bridges: QGIS: symbol level values for rendering bridges over non-bridge roads QGIS: all bridges over all non-bridge roads - intersection on bridge looks like bridge over bridge


And here is the second example from above, rendered in QGIS: QGIS: all bridges over all non-bridge roads - intersection on bridge looks like bridge over bridge (Zürich example)


If I use symbol levels with render pass numbers non-bridge road edge < non-bridge road interior < bridge edge < bridge interior, it'll look like this: QGIS: all interiors over all rims - bridge crossing road looks like intersection (Zürich example)


I think they would look right if the feature rendering order took precedence over the "Symbol levels", i.e. order two strokes by rendering pass number only if their z_order value is the same, otherwise draw them in the order of the z_order. Can I get QGIS to do that? If so, how?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...