Skip to main content
added 40 characters in body
Source Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353

Leaving aside the use of SQL or Python, I don't believe there is a one-step method in the Processing Toolbox options right now to do a k-nearest neighbour join and aggregate joined feature attributes.

However, it shouldn't be so hard using two steps. I posted an answer to a similar question at hereJoin/Summary Nearest Neighbors QGIS which involves only Processing Toolbox options. (One advantage of using the Join Attributes by Nearest tool over NNJoin is that it's in-built, and you can specify how many nearest points you want to look for and set a distance limit.)

Initially I used Statistics by Category in that answer but I have now found that the Aggregate processing tool is more flexible if you wanted to aggregate values for multiple fields all at once.

That answer involved joining data back to the source layer, grouping by an unique ID from the source layer - but you could just as group by an ID field from the target layer.

Leaving aside the use of SQL or Python, I don't believe there is a one-step method in the Processing Toolbox options right now to do a k-nearest neighbour join and aggregate joined feature attributes.

However, it shouldn't be so hard using two steps. I posted an answer to a similar question here which involves only Processing Toolbox options. (One advantage of using the Join Attributes by Nearest tool over NNJoin is that it's in-built, and you can specify how many nearest points you want to look for and set a distance limit.)

Initially I used Statistics by Category in that answer but I have now found that the Aggregate processing tool is more flexible if you wanted to aggregate values for multiple fields all at once.

That answer involved joining data back to the source layer, grouping by an unique ID from the source layer - but you could just as group by an ID field from the target layer.

Leaving aside the use of SQL or Python, I don't believe there is a one-step method in the Processing Toolbox options right now to do a k-nearest neighbour join and aggregate joined feature attributes.

However, it shouldn't be so hard using two steps. I posted an answer to a similar question at Join/Summary Nearest Neighbors QGIS which involves only Processing Toolbox options. (One advantage of using the Join Attributes by Nearest tool over NNJoin is that it's in-built, and you can specify how many nearest points you want to look for and set a distance limit.)

Initially I used Statistics by Category in that answer but I have now found that the Aggregate processing tool is more flexible if you wanted to aggregate values for multiple fields all at once.

That answer involved joining data back to the source layer, grouping by an unique ID from the source layer - but you could just as group by an ID field from the target layer.

Source Link
she_weeds
  • 13.8k
  • 1
  • 36
  • 67

Leaving aside the use of SQL or Python, I don't believe there is a one-step method in the Processing Toolbox options right now to do a k-nearest neighbour join and aggregate joined feature attributes.

However, it shouldn't be so hard using two steps. I posted an answer to a similar question here which involves only Processing Toolbox options. (One advantage of using the Join Attributes by Nearest tool over NNJoin is that it's in-built, and you can specify how many nearest points you want to look for and set a distance limit.)

Initially I used Statistics by Category in that answer but I have now found that the Aggregate processing tool is more flexible if you wanted to aggregate values for multiple fields all at once.

That answer involved joining data back to the source layer, grouping by an unique ID from the source layer - but you could just as group by an ID field from the target layer.