How can I display labels for line features in a QGIS line layer, where the label should appear outside a polygon if the line feature is inside the polygon, and otherwise appear as it is? I have activated the "name" field for labeling the line features.
I tried the below expression but it is not working.
difference ( $geometry, buffer ( aggregate( 'Rohrlage', 'collect', buffer ($geometry,15) ), 0 )) 
