I am using QGIS 3.

I am creating a topographic map using OSM data downloaded as shapefiles. Obviously of I put the railways layer under the roads layer, all railways show as passing under roads. Or if I put the rail layer on top, railways always show as passing over roads.

Is there a way to make roads, bridges and railways layer up correctly automatically: so that they go over or under as appropriate without my having to check and, where necessary force, each crossing to render correctly?

  • 1
    Check if your data has a key-attribute, see: wiki.openstreetmap.org/wiki/Key:layer – Babel Oct 29 '19 at 8:06
  • 1
    See an example here for a road that passed under the railway, how layer-key is defined as -1 and how the map is rendered: openstreetmap.org/way/38933693 – Babel Oct 29 '19 at 8:14
  • 1
    If you don't have this kind of information in your data, it will be almost impossible to achieve what you want without introducing the information manually for each case. If the information which line is on top is not so important for your map, you could use blending modes, so that both lines (street and railway) are showed in every case. Copy both line-layers to the same layer (add an attribute "linetype" for "rail", "road") and than use rule based styling: setting different line-types for linetype=road and linetype=rail and use blend-mode for objects - try muliply. – Babel Oct 29 '19 at 8:15

Features containing a value for key: "bridge" take general overlay priority. The "layer" key field also has priority. There is not a universal render order attribute; indeed, it appears that it is left to the renderer to implement the appropriate layering schema based on a variety of attributes. See these references on bridges and layer for some more information.

One available guide is the primary OSM web map. Right-click a relevant feature, select 'Query features' and inspect the related attributes to determine the case for your area of interest.

With this knowledge you should be able to assemble your map as desired with ordinary layering or additional options within the Layer Rendering drop-down and the Control feature rendering order function within the same drop-down in QGIS 3.x+

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.