3

I have a line layer for arrows in QGIS 3, and I'd like to display a marker at the end of each arrow. I tried to add a marker line on top of my arrow with a marker placed only on the last vertex, but it overlaps with the end arrow.

I suppose the ideal way would be somehow to define that I want to display my arrow line at eg 0.8 length, but not sure how to do that. A simple line visualization has a trim options, but there is nothing like that for an arrow line, and I cannot make a simple line curved.

This is how it looks now.

enter image description here

I would like to avoid the visible overlap.

3
  • Don't understand how your result should look like. Please post a screenshot showing what you want to achieve.
    – Babel
    Apr 23 at 9:38
  • This is how it looks like currently: link I'd like to avoid the overlap of a marker on the last vertex and the arrow.
    – Jeremy
    Apr 23 at 10:34
  • You should add this image to your initial question by clicking edit... So the marker (dot) should be under the arrow, is that correct?
    – Babel
    Apr 23 at 10:40

1 Answer 1

4

Move the symbol layer containing the point symbol below the line representing the arrow:

enter image description here

To avoid overlap at all and to make the arrow-line shorter, you can set the symbol layer type to geometry generator and use this expression, where 0.98 represents an end-point at 98% of the total line's length from the start point:

line_substring (
    $geometry, 
    0, 
    $length*0.98)

This, however, results in the arrow not pointing to the real end point any more as the end-point of the initial line in fact is shifted:

initial line dotted in black, arrow in blue enter image description here

To overcome this, change the expression for geometry generator to:

line_substring (
    smooth($geometry, 1),
    0,
    $length*0.95)

enter image description here

4
  • Hi, thank you for the answer. I tried to set it up exactly as you described, but my arrow is far from the point. Any idea what am I doing wrong? link I also tried to set it up to 1, the arrow moves a little bit closer, but not much. $lenght*1 Setting it up to 1.25 looks alright, but is it a right approach? I though value 1 is the full length of the line.
    – Jeremy
    Apr 23 at 14:04
  • Try lenght($geometry) instead. Better? What CRS is your layer in?
    – Babel
    Apr 23 at 14:34
  • Can you share project+sample data for testing
    – Babel
    Apr 23 at 14:35
  • 1
    I'm using WGS 84 / Pseudo-Mercator EPSG:3857. I tried to create a new project, same layer and CRS, and it works as it should. No idea, but it's on my side. Thanks for the help!
    – Jeremy
    Apr 23 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.