Geographic Information Systems Asked by Julz_Mos on March 5, 2021
I’m using QGIS 3.8 with GRASS 7.6.1
I want to add only the names of my vertices (from line intersection, duplicates deleted) to the attributtable of my lines (like start and end node). Every line has only two vertices.
What I tried:
geom_to_wkt(start_point($geometry))
–> gives me the coordinates (I need the name) of my real nodes not of the vertices
"add by position" only transfers the name of one vertices (but I need both)
In QGIS I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...
Let's assume we have two layers 'points_layer'
(red) and 'lines_layer'
(grey) respectively, see image below.
With the following query, it is possible to add only the names of my vertices (from line intersection, duplicates deleted) to the attributtable of my lines (like start and end node).
SELECT l.*, p1.Info AS start_point_info, p2.Info AS end_point_info
FROM "lines_layer" AS l
LEFT JOIN "points_layer" AS p1 ON st_equals(start_point(l.geometry),p1.geometry)
LEFT JOIN "points_layer" AS p2 ON st_equals(end_point(l.geometry),p2.geometry)
The output Virtual Layer will look like as follwoing
References:
Correct answer by Taras on March 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP