4

In QGIS I would need a Geometry Generator expression to, from a polygons layer, draws a line from the centroid of each polygon to the centroid of each adjacent polygon

enter image description here

1 Answer 1

6

Use this expression:

collect_geometries(
    array_foreach(
        overlay_intersects (@layer, centroid ($geometry)),
        make_line (centroid($geometry), @element)
    )
)

enter image description here

Your Answer

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

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