[GIS] How to Create Two Color Lines in QGIS

qgissymbology

I've been working on making mountain biking and hiking maps using Illustrator and I am now trying to move to QGIS so there's real GIS data powering the maps, making updating/scaling them easier than it is Illustrator.

One issue I've had is that when trails converge the trail creators/maintainers usually give the trails two colors while they are joined. Here's an example from the Illustrator version:

enter image description here

I'm using the following solution to style the trails with two colors, but I'm curious if there are other ways to accomplish this:

  • The trail features have two color attributes: color and color2
  • I enter a string value for the "color" of the trail: red, blue, etc.
  • If the trail segment has a secondary color I put it in "color2"
  • I style the layer using the "color" attribute
  • I duplicate the trail layer and change the styling of the new layer to use "color2" instead of "color".
  • I change the duplicate layer to use a dashed style of line instead of solid.

Now both layers are pointing to the same Shapefile but styling them differently.

Is this the best way to accomplish this type of styling?

Best Answer

I came across this video which explains how to make railroad tracks in QGIS using Symbol Layers - http://linfiniti.com/2010/12/video-tutorial-1-creating-a-custom-railway-style/

I realized I could use the same feature to make two-color lines using only one layer.

I wouldn't need to have a separate color attribute (since you can't style a single layer based on two attributes)

  • Use New Symbology
  • Add a second Simple Line to the Symbol Properties
  • Make the lines the same width
  • Make the top line dashed and the primary color
  • Make the bottom line solid and the secondary color

Symbol Properties for a Two Color Line

Related Question