1

So I have a point layer whose attributes I am trying to join to a line layer. I know you can use both the NNJoin plugin and the Join Attributes by Nearest tool in QGIS to perform a spatial join if the layers do not touch or overlap. However when I use NNJoin, the new layer has 40,037 rows while when I use Join Attributes by Nearest the new layer has 138,738 rows. I am curious as to why this is happening and if people prefer to use one tool over the other. Here are the settings I used.

enter image description here

enter image description here

5
  • 1
    Can you provide the exact settings for both tools?
    – MrXsquared
    Nov 30, 2022 at 19:59
  • 1
    What about trying the same operations with a small sample dataset to see if a similar behaviour appears there, as well? This could help finding the reason.
    – Babel
    Nov 30, 2022 at 20:13
  • Did you read the documentation and help of both tools? Help of Join attributes by nearest says: "By default only the single nearest feature is joined,but optionally the join can use the n-nearest neighboring features instead." So without knowing your settings, its difficult to give an answer.
    – Babel
    Nov 30, 2022 at 20:15
  • So I figured out that each traffic point actually has another point beneath it. One point represents northbound data and the other represents southbound data. When you use NNjoin only the north bound data is joined while when you use Join Attributes by Nearest both points are joined. I think I am going to use Join Attributes by Nearest since both points are included and you can set a maximum distance, which I need to do for this data. When I used NNJoin streets far away were joined to non-relevant traffic data.
    – Ian Moffit
    Dec 1, 2022 at 1:02
  • Thank you for the suggestion about using a sub-sample of the data set Babel!
    – Ian Moffit
    Dec 1, 2022 at 1:04

1 Answer 1

3

So I figured out that each traffic point actually has another point beneath it. One point represents northbound data and the other represents southbound data. When you use NNjoin, only the north bound data is joined while when you use Join Attributes by Nearest both points are joined.

Therefore, I am going to use Join Attributes by Nearest since both points are included and you can set a maximum distance, which I need to do for this data. When I use NNJoin streets far away were joined to non-relevant traffic data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.