Starting from a layer with point geometry, my goal is to do two calculations in one Geometry Generator expression.
First, for each point, I would like to calculate the centroid for the 5 points nearest to it.
Next, for each calculated centroid I would like to draw the 10 nearest lines connecting to it.
To calculate the centroid I am working with the following expression:
centroid(collect_geometries (
array_foreach (
overlay_nearest (
'TEST',
$geometry,
limit:=5
),
make_line (
$geometry,
@element
)
)
))
To draw the line I used this expression:
collect_geometries (
array_foreach (
overlay_nearest (
'CENTRO',
$geometry,
limit:=10
),
make_line (
$geometry,
@element
)
)
)
Result:
My goal is to unify the two expressions in a single expression for the Geometry Generator that works with the original layer.