I want to create tangential lines for each point along a shoreline in QGIS, such as the dashed line I've hand-drawn.
These points are not randomly spaced, they each represent the angle at which each control point is measured along the shoreline.
I want to create tangential lines for each point along a shoreline in QGIS, such as the dashed line I've hand-drawn.
These points are not randomly spaced, they each represent the angle at which each control point is measured along the shoreline.
This can be achieved with a Geometry by Expression / Geometry Generator expression.
-- find the nearest line to the current point (change 'coast layer' for the name of your line layer)
with_variable('coast',
overlay_nearest('coast layer', @geometry)[0],
-- get the angle of the line at the current point
with_variable('angle',
line_interpolate_angle(
@coast,
line_locate_point(
@coast,
@geometry
)
),
-- use that angle to generate a tangent (50 m in either direction of the point in this case)
make_line(
project(@geometry, 50, radians(@angle)),
project(@geometry, 50, radians(@angle - 180))
)
)
)