I have a stream layer. Each stream segment contains a "z_ini"
and a "z_fin"
, where "z_fin" < "z_ini"
.
How can I graphically display the direction of the flow of the courses by positioning an arrow on the watercourses?
You can modify the line itself with "geometry by expression" from processing toolbox. Use this expression:
case
when z_at(@geometry,0) < z_at(@geometry,-1) then reverse(@geometry)
when z_at(@geometry,0) = z_at(@geometry,-1) then @geometry
when z_at(@geometry,0) > z_at(@geometry,-1) then @geometry
end
In your case you can replace z_at(@geometry,0)
with "z_ini"
and z_at(@geometry,-1)
with "z_fin"
.
If you run it, your lines will follow z direction and you can use an arrow style line with standard settings as you like.
You can use a marker style with a pyramid/triangle as arrow. Then you can set the rotation of the markers to follow the z direction. Use
case
when z_at(@geometry,0) < z_at(@geometry,-1) then -90
when z_at(@geometry,0) = z_at(@geometry,-1) then 0
when z_at(@geometry,0) > z_at(@geometry,-1) then 90
end
as data defined override on the marker rotation. In your case you can replace z_at(@geometry,0)
with "z_ini"
and z_at(@geometry,-1)
with "z_fin"
.
Rotation of -90 and 90 is valid for the ones marked in red. For the ones in blue you need to use another value for the rotation.
For arrow style you can use a data defined expression:
case
when z_at(@geometry,0) < z_at(@geometry,-1) then 'reversed'
when z_at(@geometry,0) = z_at(@geometry,-1) then 'double'
when z_at(@geometry,0) > z_at(@geometry,-1) then 'single'
end
In your case you can replace z_at(@geometry,0)
with "z_ini"
and z_at(@geometry,-1)
with "z_fin"
.