# QGIS how to combine a single line and a centered short and constant offset arrow line

I am making a flow map where I want to have a double geometry: a single line and a centered offset arrow line. For the moment, I use a buffer but of course I don't get the desired effect of an arrow of constant length. With the buffer the length of the arrow depends on the segment.

``````difference(
difference(
make_line(
start_point(\$geometry),
centroid(
offset_curve(
\$geometry,
length(\$geometry)/100.0
)
),
end_point(\$geometry)
),
buffer(start_point(\$geometry), 0.1)
),
buffer(end_point( \$geometry), 0.1)
``````

)

• Can't you use an oriented vector symbol as the (long) arrow? Point geometry as line centroid + offset & orient it with the line azimuth? Apr 18, 2023 at 17:10

Use Marker Line instead of Geometry Generator. Set the Marker placement to On central point of segments, and set the line offset. Then you can define two symbols inside the marker, first a line like this:

And then a triangle like this:

The result:

If I understand your question correctly, you can interpolate the start and end points of your arrow line along the geometry of the feature, insert a mid-point which is offset from those and then offset all of them from the original geometry.

Better explained by this image:

Expression:

``````offset_curve(
make_line(                            -- make a line of the following 3 points
line_interpolate_point(
\$geometry,
length(\$geometry) / 2 - 50    -- make a point X map units before the midpoint of the line geometry
),

line_interpolate_point(
offset_curve(
\$geometry,
length(\$geometry) / 75
),
length(\$geometry) / 2         -- make a point halfway along the geometry, offset by X map units
),

line_interpolate_point(
\$geometry,
length(\$geometry) / 2 + 50    -- make a point X map units after the midpoint of the line geometry
)
),
length(\$geometry)/100                 -- offset the line from the original geometry
)
``````
##### Applying the expression

The expression is applied to a Geometry Generator symbol layer as shown here:

You might want the offsets to be a fixed distance, rather than relative to the line length, but that is a design choice that's up to you of course.

##### Arrow per line segment

If you want the arrow to appear per line segment, rather than for the complete feature, you can use this expression:

``````collect_geometries(
with_variable('segments',
segments_to_lines(\$geometry),

array_foreach(
generate_series(1, num_geometries(@segments)),

with_variable('current_segment',

geometry_n(@segments, @element),
offset_curve(
make_line(
line_interpolate_point(
@current_segment,
length(@current_segment) / 2 - 50
),

line_interpolate_point(
offset_curve(
@current_segment,
length(@current_segment) / 75
),
length(@current_segment) / 2
),

line_interpolate_point(
@current_segment,
length(@current_segment) / 2 + 50
)
),
length(@current_segment)/50
)
)

)

)
)
``````

• Thank you for helping but I am lost in the UI of QGIS. Can you add a screenshot of the symbology window ? Apr 19, 2023 at 6:05
• Have done. I hope that is clearer.
– Matt
Apr 19, 2023 at 11:31