5

I am using QGIS with OpenStreetMap data and I am trying to copy the way OpenStreetMap renders the order of their roads using the 'z-order' field. I am very close, I managed to use the layer properties to blend the roads where they join together using 'symbol levels' in the Symbology tab:

enter image description here

However, where roads are elevated over other roads I want it to look like the picture below in OpenStreetMap. I know they use the 'z-order' field and I know this can be done in QGIS using the 'control feature rendering order' option and choosing the z-order field, but I can't seem to get it to work.

enter image description here

The following are my layer symbol properties. I also checked 'Control feature rendering order' and used the z-order field:

enter image description here

I set my Symbol Levels as follows:

enter image description here

And I get the image below.

enter image description here

so I think I am close. I think the key may have something to do with the "bridge"=>"yes" tag in the Other_Tags attribute. Please see my new symbol properties above, I duplicated the symbols so one set has bridges and the other does not (LIKE and NOT LIKE). I then set the symbol levels so the "bridged" set renders above the "non-bridged" set. Plus, I checked 'Control feature rendering order' and used the z-order field. I also made the outer line flat as @mapperx recommended which helped. I was able to produce the last image above which I think is very close. However, you can see there are now "breaks" (circled red) where two segments join that both include the tags "bridge"=>"yes". This makes sense because of the way I setup the symbol levels. I have played with this for most of the day, but I can't for the life of me figure this out. I know it can be done because OpenStreetMap does it perfectly.

9
  • 1
    You need to set the symbol level order. If you look at the image showing Symbol properties above, there is the Symbol Levels option. You need to set a column/order attribute which defines how it will render.
    – mapperx
    Jun 14 at 17:08
  • 1
    Hi @mapperx, thank you for your continued help. I updated some information in my original post and updated the images. Please see my note at the bottom of the original post. I know this can be done because OpenStreetMap does it perfectly. If you look closely at their map there are no breaks and each segment blends into the next.
    – floyd434
    Jun 16 at 2:14
  • 1
    I have added some images and explanation can help you. Try to look at the relationship of the z_order and all the possible attributes which is used in styling each road group(highway class, other_tags conditions. There is no quick fix Also this is my own approach, someone else my do it differently.
    – mapperx
    Jun 16 at 12:22
  • 1
    @mapperx, thank you for all your help! I used all your suggestions and ended up classifying by Type, then adding ranges to each type based on the z-order field (right-click the Type in Layer Properties, Refine Current Rule, Add Ranges to Rule). Then I set Symbol Levels for each z-order range so the lines would render over/under each other appropriately. I did not end up needing the 'Control feature rendering order' option. This gave me exactly what I was looking for. Thank you again!
    – floyd434
    Jun 16 at 21:43
  • 1
    It was a learning process for me too. Happy mapping!
    – mapperx
    Jun 17 at 8:41
5

First, there is a z-order column in Openstreetmap data. You can use this in setting the rendering order. @das-g gave a good answer to a similar question (the link is to the answer provided) Applying OSM z-order after osm2pgsql with qgis. The answer gives a good explanation on how to go about. I will add some explanations and images that can help as well.

enter image description here

In the second image you attached, you need to enable Symbol levels and for each symbol adjust the number to set its hierarchy. This hierarchy determines the order of how each Category of line overlap enter image description here With regards to the lines having breaks, most of osmdata lines (in this case I am referring to the roads) are in segments. So a particular street might have multiple segments. You need to adjust the line Cap Style. This defines how the lines/segments end and overlap each other,(it also might depend on your line styling having outercase and innerline). I would use Square for the inner and Flat for the outer. There is also Round option depending on the style you want. enter image description here


Part 2:- Based on your corrections and what you have done so far.

I tried to reproduce something similar. I have used a different approach to filter the road classes. Its should give you a rough idea. enter image description here

From the screenshot of your Symbol level, you need to increase the values for each group depending on its hierarchy. The z-order will give you an idea of the value a line/road has. The higher the value the higher its hierarchy. That way the group can be raised accordingly. enter image description here

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.