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. 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 (see Virtual layer functionality does not seem to support memory layers).
Is there any reasonably straighforward way to achieve this using QGIS?