2

I am creating, by Geometry Generator, an archaeological graphical style for lines. The goal is to be able to create automatically "hachures" that connect the external perimeter to the internal line (base of slope layer called "line" in my case).

I am working on creating a point layer at the vertices of the line using the Extract vertice tool. The points are symbolised with a complex style:

  1. lines created with Geometry generator using the expression

shortest_line($geometry, aggregate('Lines', 'collect', $geometry))

  1. a triangular simple marker at the beginning of the line

Both symbols are oriented using the expression

angle_at_vertex(shortest_line($geometry,  aggregate( 'Lines','collect', $geometry)),0) 

The system works quite well with isolated geometries.

enter image description here

My problem is that when two polygons are too close, the shortest line representing the hachures is created not in the direction I would like to, but connecting the external line to the closest line "break of slope" that in many cases is the wrong one.

enter image description here

Any suggestion on how to fix this error and how to be able to control the behaviour of the lines?

1

This seems to be the expected behaviour with shortest_line() to the entire set of line features from aggregate().

Can you assign the vertices with the id column of the line you actually want then to join to (you could use join by nearest processing algorithm and manually fix outliers)?

Then use that to filter your aggregate expression eg `aggregate( 'Lines','collect', $geometry, "id_in_line_layer"=attribute(@parent, 'joined_id_in_point_layer'))?

| improve this answer | |
  • Thanks for the answer. I have already tried in this direction and, of course, helps. But calculate the relative id for a large amount of data that often overlaps more than one line doesn't help. Too many manual corrections requested. Also calculating by expression don't resolve it. – Val P Apr 6 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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