I'm working in QGIS with two shapefiles: point and line. Points mark nodes of the lines, and each of them have their own attributes. Lines are related to an attribute table too. The goal is, once the lines are exploded between nodes, to join ONE point attributes to each new line section. How can I join point attributes to each line section? (better not using any plugins, so I still cannot download them)
Try "join attributes by location".
Problem is, that the lines by definition have two nodes.
Without using any plugins... then only tool I can think of is a Virtual Layer.
- You have one
segmentslayer (exploded line, and saved as a new line shapefile)
- You also have one
pointslayer. And the data you want to extract is stored in the
(1) Go to menu
Layer | Add Layer | Add/Edit Virtual Layer.
(2) Click on
[Import] and select your
(3) In the Query window, give an expression:
SELECT segments.*, points.your_data FROM segments, points WHERE st_intersects(st_buffer(st_startpoint(segments.geometry), 10), points.geometry)=1
Additional note -
- In the above example there is a
st_buffer(..., 10)which is a tolerance radius
(10m)between your points and nodes of linestring.
- If the points are located at the exactly same as nodes,
st_intersects(st_startpoint(segments.geometry), points.geometry)=1would work just fine.
- (and you may want to use