I have two line layers. The features of both are touching each. Now I would like to label one of the line layers with the attributes of the touching layer.

The case: In the one layer are drain's (green) and in the other one are cables (red). The cables are inside the drain (digitized with snapping to the drains). Now I need the drain-id (green labels) labeled on every cable.

enter image description here

I have to use shape files! So I thought to use the aggregate function of QGIS...

  • 2
    If you're going to publish this map, please choose a different color scheme. Red + lime green is a combination that appears to vibrate on the screen. It will give most users of your map a headache, and anyone with red-green colorblindness won't be able to read it at all. – csk Apr 29 at 17:10
  • 1
    In your screenshot, the lime color object looks like a generic, i.e. as one map object, then where does it come from different green signatures? – Cyril Apr 30 at 6:24
  • I used symbol levels... And I will choose other color combination next time! – MAP May 2 at 14:43

You can use RefFunctions Plugin together with this expression:


'drain' is the targetlayername and 'drainid' the targetfieldname you want to get.

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.