QGIS symbology: How to apply outer glow to just one side of a line?

You can use the Transform under the Effect type in which you can shift slightly the Outer glow using Translate x,y as follows:

  1. Activate the Draw effects:

enter image description here

  1. Add a new effect, and under effect type, select Transform. Put the Transform layer between Source and Outer glow. Choose Modifier Only under Draw mode, and select pixels as unit. Then change the x and y under Translate to shift the Outer glow:

enter image description here

  1. Change the Draw mode for both Source and Outer glow layers to Render only

Here is the final output:

enter image description here


Here is a bit of a workaround.

  1. Use geometry generator to generate a line that is 'buffered' out from the original one in one direction. I used this expression: difference(boundary(single_sided_buffer($geometry,(0.001*@map_scale))),$geometry)

    (using scaled map units for buffer size - you may need to modify accordingly especially if not using a projected CRS)

    It is the difference between the original line and the boundary of a single-sided buffer to the left. See the dotted line below. (To buffer to the right use -0.001)

enter image description here

  1. Move the original line above the generated line in the list of symbols using the little up arrow button, as below

enter image description here

  1. Style the generated line to have an outer glow but no Source

enter image description here

enter image description here

With the @map_scale expression above it should work even when zoomed out:

enter image description here

Because of the single-sided buffer it will always stick to one side of the line depending on the orientation in which it was drawn. See the lines below - if you draw a 'closed' line going clockwise it will draw the buffer on the outside (left). If the line is anti-clockwise it will be on the inside.

enter image description here

If some of your lines are not drawn in the right order you can reverse them by selecting the lines you need reversing and using the Reverse line direction tool in the Processing toolbox (and click the Edit Features In-Place button at the top so that it will just edit those features without creating a new layer).

Tags:

Qgis

Symbology