1

I've made a distance matrix from one point layer (layer A) to another (layer B) using QNEAT plugin (QGIS Network Analysis Toolbox 3).

I got a web with links from every point from A to every point from B, but I don't need that many links. I need to have unique links from A to B, and once a point from B is taken by any point from A, it cannot be selected for a link.

In other words, I'm looking for a way to filter the data which I got using QNEAT.

1
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Aug 4, 2022 at 13:45

2 Answers 2

1

What you want to do can only work if you have the same number of points in both layers, so I suppose this is the case.

So basically, for each feature of layer A (in QNEAT output referenced with origin_id) you want to get a distinct/unique feature of layer B (destination_id) linked - as shown in the screenshot, the selected features (marked in blue):

enter image description here

This can be done selecting the smallest origin_id with the smallest destination_id, second smallest origin_id with second smallest destination_id etc. To do so, use Select by Expression with this expression:

destination_id =
array_get (
    array_sort (
        array_distinct(
            array_agg (destination_id)
        )
    ),
    array_find (
        array_sort (
            array_distinct(
                array_agg (origin_id)
            )
        ), 
        origin_id
    )
)

0

In general, the 'Join by lines (hub lines)' tool will connect points in A to the nearest point in B. However, as far as I know, there is no tool that ensures that every point in B is assigned to at most one point in A.

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.