I would like to know if there is any way to generate a connecting line between 2 points layers (blocks-points representing a watershed, concpoints-points representing the concentration location of the flow from that watershed) through the geometry generator in the style panel of QGIS, with the specification that in some cases there is a relationship of several basins concentrated in a single point.
In these specific cases, the attribute "ID_UC" that indicates which basins contribute to a concentration point is a string that separates the basin ID's ("ID_QE" attribute of the layer blocks) using a comma, as in the following image:
As you can see in the following image, I was able to accomplish the task for simple cases where there is a ratio of 1 basin to 1 concentration point, using the expression
make_line(
start_point($geometry),
geometry(
get_feature(
'concpoints',
'ID_UC',
"ID_QE"
)
)
)
I imagine that there is a way within the geometry generator to transform the string field "ID_UC" into an array, where each element would be the ID of a different basin, and thus be able to make this connection between the blocks layer and the concpoints layer, or another way to generate these connection lines.
Best Answer
You can do this using
array_foreach()
functioncollect_geometries(array_foreach(string_to_array( "ID_UC" ),
Use this expression on the 'concpoints' layer.