I have a layer of points (Waterfalls) and a layer of lines (Watercourses) with no linking information between them.
I am looking to use a QGIS expression to estimate the angle of the waterfall for the purpose of symbolising it.
The intention is to use the angle of the segment of the watercourse (line) nearest to the waterfall (point) as a proxy for the angle of the stream, and that the waterfall angle will be this rotated by 90 degrees - like the black line across the stream below.
I can easily find the geometry of nearest watercourse for a given waterfall using overlay_nearest
:
overlay_nearest('Watercourse',@geometry)
However, I don't see an easy way of getting the nearest segment of that geometry, nor its angle. segments_to_lines
would break the line into segments, but I'm not sure how to then get the closest.
Using line_locate_point
and then line_interpolate_angle
would work but seems a very indirect method. Hopefully someone can point out an alternative.
line_locate_poin
t andline_interpolate_angle
to be an indirect method? I think it's the best in this case, quite straightforwardline_locate_point
/line_interpolate_angle
lacked elegance. I was hoping for an easy way of identifying the closest segment. It appears that it's doable but not that easy.