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.
-
you can have a look to the NNJoin Plugin: arken.nmbu.no/~havatv/gis/qgisplugins/NNJoin– eurojamCommented Apr 6, 2021 at 18:53
-
Also have a look at this post - if I understood your question well, you intend to do something similar: gis.stackexchange.com/q/386867/88814– BabelCommented Apr 6, 2021 at 20:11
2 Answers
If you are using QGIS 3.8+ you can use "Join Attributes by Nearest" from processing toolbox:
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.
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.