1

I have about 16000 points with speed on the roads and some roads (lines). I need to join points to lines and their attributes so that there are speed values from points in the line attributes. I have no idea what to do.

enter image description here

Vince
  • 20,017
  • 15
  • 45
  • 64
watskyyy
  • 11
  • 1
  • you can have a look to the NNJoin Plugin: http://arken.nmbu.no/~havatv/gis/qgisplugins/NNJoin/ – eurojam Apr 06 '21 at 18:53
  • Also have a look at this post - if I understood your question well, you intend to do something similar: https://gis.stackexchange.com/q/386867/88814 – Babel Apr 06 '21 at 20:11

2 Answers2

3

If you are using QGIS 3.8+ you can use "Join Attributes by Nearest" from processing toolbox:

enter image description here

Choose your line as "Input layer", your points as "Input layer 2", if you wish to also the fields you want as well as the maximum nearest points and the maximum distance. The tool will create a copy of your line for each joined point.

MrXsquared
  • 34,292
  • 21
  • 67
  • 117
2

If you are using QGIS 3.16+ you can use overlay_nearest() expression, such as:

array_to_string(overlay_nearest('points',"fieldname_you_want_from_points_layer",limit:=3),',')

Simply adjust layername, fieldname and the limit. The limit stands for the maximum nearest points to join. You can also add max_distance:=XXX if you only want to join points within a given maximum distance. overlay_nearest() will return an array of your attributes (or features or whatever you want to get. You can turn this into a string for example by using array_to_string(). This will create no duplicates of your line and edit the existing line-layer.

MrXsquared
  • 34,292
  • 21
  • 67
  • 117