In QGIS, I have a line layer with straight lines, consisting only of two vertices: start- end endpoint. I can now use Geometry Generator (see below for the expression I use) to create a third point in the middle of the line and shift it perpendicular to the line to get a triangle-shape line (see screenshot: yellow point, black dotted line). This is to apply an arrow symbol-layer style with curved arrows (blue arrows).
If I use the same Geometry Generator expression to create the triangle, but add a smooth()
function, I also a curved line (red line), however, it's a different shape.
Question: what does the arrow line represent, how is it geometrically constructed? I would like to recreate the blue (arrow) line with Geometry Generator. It seems to look like a circular segment, however, I'm not sure how to construct it.
Screenshot: highlighted in yellow the expression to create the red lines:
The expression I use to create the triangle-shaped line looks as follows:
make_line (
start_point($geometry),
project(
centroid($geometry),
400,
azimuth(
start_point($geometry),
end_point($geometry)
)-radians(90)
),
end_point($geometry)
)
Best Answer
Unfortunately, it is not a desirable Geometry Generator, however, I can suggest a PyQGIS approach. It is primarily based on the
segmentizeArc()
method of theQgsGeometryUtils
class. Perhaps this tool would be a nice add-on to QGIS functions.Let's assume there is a polyline layer (five features), see the image below. Line visualization imitates OP's example.
Proceed with
Plugins > Python Console > Show Editor
(Ctrl+Alt+P) and paste the script below:Press
Run script
and get the output that will look like: