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

2

2 Answers 2

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.

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.

Your Answer

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

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