Taking inspiration from @Babel's answer, here is a variant that allows having a smoother width transition and the arrow in the same style.
- Create a virtual layer that will subdivide your line into around 100 segments.
Go the the menu layer / add layer / add-edit virtual layer
and enter the following query.
SELECT ST_Segmentize(geometry,ST_length(geometry)/100.0)
FROM myLayer
- Style the virtual layer to increase its width
Choose a single symbol
, then a geometry generator
line and enter the following to split every segment into its own line.
segments_to_lines( smooth( $geometry) )
Feel free to remove the smooth()
if your line is already curvy enough.
Select the generated line style and click the data override
icon beside the width
setting. Select edit
and enter the following expression.
It will set the width of all but the last segment. The width ranges from 2 * 1/100 for the 1st created segment to 2 * 100/100 for the last one.
if(@geometry_part_num < @geometry_part_count, 2.0* @geometry_part_num / @geometry_part_count,0)
Go to the simple line
style and set a round cap style
- set the arrow
Click on the "top" line, click the green +
beside it, add a new style, choose again a geometry generator. Enter the expression you have provided
select the arrow and set the width start
to 1.98 (because the last displayed segment in the previous step was 2 * 99/100 = 1.98) and the width
(end) at 2. You may want to play with the head length or thickness to make it look good.