I am trying to perform a spatial join based on nearest neighbor ("CLOSEST") spatial relationship in QGIS, and by summing the results of the join where multiple matches occur.

In ArcMap there is a way to do this using the spatial join tool, selecting the "CLOSEST" Match Option, and specifying a "SUM" merge rule for the joined attributes. enter image description here I would like to find a QGIS equivalent of this operation. I have already found a plugin which can do a "nearest neighbor join" called NNJoin. I am reasonably satisfied with the results of this plugin. Please note my input shapes are all MultiLineStrings (both target and join feature).

Now I would like to join this resulting table from NNJoin back to my target feature, but it has to sum things for multiple matches. I started fiddling around with the Virtual Layer option in QGIS in order to come up with some SQL code that can do this for me, but I have the impression that the Virtual Layer options are still defective in QGIS (Please see my previous question).

Is there any reasonably straighforward way to achieve this using QGIS or am I doomed to using ArcMap....?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.