I want to use the "Line Intersection" function in QGIS to create points wherever lines cross. The lines are roads and I need the road names in my points layer.
Does anyone have an idea how I can add the street name of each line to the point layer without creating points twice? The street names are in the input layer (osm roads).
The first image shows what it looks like when I use the line intersection feature. I have 12 point features for the same intersection. The second image shows how it should be. The other data is not important for me.
Not what I want:
enter image description here
That's how it should be:
enter image description here
1 Answer 1
Use the Field Calculator with this expression:
array_to_string(
array_sort(
array_distinct(
overlay_touches(
layer:='lines_layer_name', --specify the name of your line layer
expression:="name_2") --specify the targeting field
)
)
)
This expression utilizes the following functions: array_sort()
, array_distinct()
, and overlay_touches()
.
References:
-
2Thank you very much! I worked with a short addition: array_to_string( array_sort( array_distinct( overlay_touches( layer:='Test_osm', --specify the name of your line layer expression:="name") --specify the targeting field ) ) )lena– lena2022年06月13日 14:00:28 +00:00Commented Jun 13, 2022 at 14:00
Explore related questions
See similar questions with these tags.