0

I would like to find a dynamic method, using a Geometry Generator expression, to draw a categorized lines geometries from a range values of lines angles

I try to expose the initial state of the lines geometry layers with the following screenshot:

enter image description here

And I try to expose the expected result I would like to obtain. As you can see, you would have to draw a line for each group of angle range and theme them by graduated size. The length of the line would have to be the average of the length of the lines of each group:

enter image description here

Acperience
  • 1,112
  • 1
  • 10
  • 2
    Do the lines have some attribute of which group it belongs to? If not how do you define the groups – BERA Apr 28 '23 at 08:58
  • I am currently storing only the angle and length. My idea is that the groups are created in a fuzzy smart way, like an automatic Equal Count style sorting that detects the main average angles – Acperience Apr 28 '23 at 09:19
  • I add more detail to the answer: my idea is that the groups are defined by an automatic classification of, for example, 4 categories. I mean that, for example, a number of groups (4) can be defined in the expression – Acperience Apr 28 '23 at 10:04
  • 3
    Try something and ask if/when you get stuck – BERA Apr 28 '23 at 13:16

1 Answers1

2

I think there could be a solution to get clustering trend line geometries, based on the overlay_nearest function. Here is a proposal solution based on an expression presented in the question 'Dividing polygon using centerline in QGIS'. In this function we combine the functions 'intersection' 'overlay_nearest' and 'buffer', which when applied to a line geometry layer we obtain the main oriented lines group to a closest neighbor. I hope it can help someone.

Expression:

collect_geometries (
    array_foreach (
        generate_series (
            1, 
            num_geometries (segments_to_lines ($geometry))
        ),
        intersection(
            overlay_nearest ('LINIES',expression:=$geometry,max_distance:=100)[0],
            buffer (
                geometry_n (segments_to_lines ($geometry), @element),
                10000
            )
        )
    )
)

The following is the result:

enter image description here

Acperience
  • 1,112
  • 1
  • 10