This is follow up to this question answer

I have in QGIS 3.22 two point layers:

  • multipart type point layer
  • singlepart type point layer

Multipart pointlayer Geometry generator algorithm:

collect_geometries (
    array_foreach (
        overlay_nearest (
            'singlepart_point',  -- rename the layer if necessary
        make_line (

I want to connect the features on the multipart point layer to the singlepart point layer. Probably first should convert multipart vertices to singlepart and then connect them to find the connection to the 2 nearest points. Unfortunately I couldn't get this algorithm to work correctly, can you help me to correct algorithm?

  • It thought that this (Google Drive File) expression could solve the problem, but then I saw that I was facing an issue. My work flow was: 1. loop throw each point of the multi-point geometry. 2. Aggregate the single-point geometry layer returning geometries ordered by distance. 3. make lines with the first two points of the step 2. It looks like variables changes when they are into an aggregate expression.
    – Mayo
    Nov 21, 2022 at 17:59
  • I suggest you to write your own custom expression for this.
    – Mayo
    Nov 21, 2022 at 18:00


Your Answer

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

Browse other questions tagged or ask your own question.