3

Are there a way to assign the attributes of a point to a overlapping polygon?

I got the data as lines and points. The lines are making the polygons and the points are overlapping the created polygon with the data stored the the point, but I need polygons with the same data as in the points for my analysis.

1
5
  1. To create polygon from the lines, use Geometry by expression with this expression:

    make_polygon($geometry)
    
  2. To get the attribute value of overlapping points, use field calculator with this expression:

    overlay_contains('points', value)[0]
    

Inputs are red points and red line; blue polygons created with step 1. Polygons are labeled with the expression from step 2:

enter image description here

0
4

Try:

Takes an input vector layer and creates a new vector layer that is an extended version of the input one, with additional attributes in its attribute table.Takes an input vector layer and creates a new vector layer that is an extended version of the input one, with additional attributes in its attribute table.

0
0

You can use a virtual layer with this query, where polygon is the name of your polygon layer, point the name of the point-layer and poly_id / pt_id the names of the respective unique id in the two layers:

select pol.poly_id, poi.pt_id , pol.geometry
from polygon as pol join point as poi on st_within(poi.geometry, pol.geometry)

Red dots and red outline: initial layers (point, polygon); dark yellow: virtual layer with the id of the point within each polygon as label: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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