I have used the distance matrix tool for a large point set (100 000+ points) to find three closest POI's from another layer and their distances. The distance matrix outputs a table much like this:
source target_id distance 1 2 100 1 3 110 1 4 120 2 1 100 2 3 200 2 4 210
My point layer is now even bigger because each original point has three separate features which only difference is the target_id and the distance from source to target. I would like to have the target_id and the distance in separate fields in one feature per source_id.
source target_1 distance_1 target_2 distance_2 target_3 distance_3 1 2 100 3 110 4 120 2 1 100 3 200 4 210 ...
I have tried all the basic tools I can use in QGIS without any luck. Seems like I am trying to do a "many-to-one" join, which can not be made with join-by-attribute. Merging or dissolving the layer to itself doesn't help either. I suspect this could be a simple SQL join operation but I have no idea how I could perform it.