[GIS] Showing arrowheads at the midpoint of a line with QGIS

qgissymbology

This is related to the question Showing arrowheads in line end using QGIS?

But I wanted to show the arrow head at the mid-point of a line. This is because the arrow heads can be quite crowded when they meet, e.g. at a common junction (as shown below).

enter image description here

My question is:

Is there a way to show the arrow head at the midpoint of a line (in general a certain percentage of length in linear referencing)?

(This is with QGIS 3.2.0-Bonn)

Best Answer

You can workaround by using a marker line with a triangle marker:

screenshot of QGIS 3.2 symbology

  1. Add a Simple line
  2. Add a Marker line
  3. In "Marker" choose "triangle2"
  4. In "Marker line > Marker Placement" either choose:

screenshot of marker placement options in QGIS 3.2

For Midpoint

Choose "on central point"

For percentage of length

choose "on first vertex only". Next to "Offset along line" switch to "Map units" and then choose "Edit..." in the corresponding context menu.

Edit... highlighted in context menu of offset along line

In the Expression String Builder type $length * 0.2 and then press "Ok". Replace "0.2" by the desired percentage.

$length * 0.2 in expression string builder

This is the result:

Marker at 20% of line length