2

A similar question was already asked two years ago, but no answers were provided, things may have changed, or if not developers may now consider this something for a future version.

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

However that question was only about the last two affecting rendering order whereas my question also features data in multiple layers that also affects rendering order.

So it seems that there are three factors which possibly affect rendering order in QGIS and the order of preference is:

Layer Rendering Order Symbol Levels Feature Rendering Order

This doesn't seem to be officially documented and myself and the person asking the previous question have just discovered it while trying to get things to render in a certain order and finding it impossible.

The data I have is Ordnance Survey's Open Zoomstack. This breaks roads down into three separate layers: National, Regional and Local. Each of those layers also has a 'level' field to indicate bridges ('1') and bridges over bridges ('2') and so on, and naturally this is what feature rendering order is for.

Right away, the issue is that I can't seem to find a way to ensure that a level 1 feature is always drawn over a level 0 feature regardless of layer. I've ordered the layers National > Regional > Local and therefore National roads will always be drawn over Regional roads, even if the national road is level o and the regional road is level 1, meaning that the regional road should appear as a bridge over the national road.

Similarly symbol levels always override feature order (but not layer order). If you use two symbols to create a road with an outline (or perhaps three to create a road with a centre-line) and use symbol levels to ensure it looks right where roads intersect then firstly, you can only intersect roads in this way if they are in the same layer. So I can't have local roads intersecting with regional roads. Meanwhile where roads in the same layer should appear as bridges rather that intersections, then they will intersect anyway since the symbol level will override the feature rendering order.

I haven't used ArcGIS in quite some time but remember that you could make symbol levels apply to an entire group of layers in that. Perhaps this is a feature that QGIS should also have, as well as being able to do similar with feature order.

Perhaps a more flexible solution for QGIS would be if the render order for each individual symbol was a combination of symbol order, feature order and layer order. For example if the symbol order is 2, the feature order 3 and the layer order 1, then it will be drawn in rendering pass 6. If then you wanted to ensure that a certain feature was always drawn on top, you could set its feature order to something high like 100. If you wanted a certain symbol to always be drawn at the bottom then you could get the symbol order to -100 (or the expression in my case, 'level*100'), and so on. You'd need to be able to also assign numerical values to layer rendering order too.

  • Could rule-based styling for a single layer, with special rules for e.g. bridges, solve your dilemma? – Erik Jun 26 at 13:36
  • I don't so since it would still be subservient to layer order – Will M Jun 27 at 16:27
  • "for a single layer" aka merge all your layers. – Erik Jun 27 at 16:32
  • ah right, I mean in this specific case the problem is that the data is updated every six months, so it would be better if there were a solution that didn't involve changing the source data in any way. – Will M Jul 3 at 13:56
3

These kinds of problems are byproducts of data creation/organisation.

If you use data for map creation you will not necessary organise your data/database the same way than for data analysis (and I guess that webmapping may have different requirement than printed map). The way (file format, data organisation...) the data are provided are generally not what is the best fit for the end user goal. As the end user you generally have to process/organise the data in a suitable way before actually beginning to work with it.

For your specific use case I think the way is to merge all three layers ( National, Regional and Local) onto one Road layer then use symbol level to deal with the intersection. For bridge you duplicate this layer, filter it by "level">0 and made sure that that it's above (Layer order) the all road layer. you could then style it with a bridge symbol (or several for different kind of road/bridge) and use feature rendering order to deal with bridge over bridge.

This way you work with one layer only and have all the tool to render your data the way you want, you could even use a virtual layer to merge the three dataset so you don't have to create a fourth layer....

  • 1
    I'd really like to know OS' reasoning behind dividing the road network in three tables. Here, our government supplies the entire network, including forest roads, in 1 table. It sure saves us some headaches. – Gabriel C. Jun 26 at 14:20
  • Well my question was general as it's the sort of issue that raises its head quite frequently. Not all examples are ones where you can simply say the data was put together suboptimally. In this case the main issues with workarounds is that the dataset is very large and updated on a 6 month basis so you wouldn't want to have to apply the merge and subdivide technique every time they do. – Will M Jun 27 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.