4

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

5

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:

1
  • 2
    Thank 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
    Jun 13, 2022 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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