QGIS Attribute Setting – Matching Points from Another Layer

fields-attributesoverlapping-featurespointqgisvector

I have two layers of points:

  • The first layer contains points which have an attribute called "svf" with values between 0 and 1
  • The second layer contains a subset (in terms of location) of the points in the first layer

The green points are from the first layer, the big blue ones are from the second layer:

enter image description here

What I want to do now is to set the "svf" value to 0 for all points in the first layer, who have a corresponding point in the second layer.

I tried it using the "Join attributes by location" tool, but I couldn't get it to work the way I wanted it to.

Best Answer

You can select the nearby points using "Select by expression", then you can open the calculator to update the desired field.

The expression would make use of overlay_nearest() to find points having a nearby point in the 2nd layer. You must specify a maximal acceptable distance between the points (beware of the coordinate system unit)

overlay_nearest('layer_2_name', max_distance:=0.1)

enter image description here

Related Question