QGIS Labeling – Avoiding Overlapping Features with Another Layer

labelingqgis

With QGIS 2.12.2, how can I set up layer labeling to avoid placing labels where features from another layer already exist?

For example, if I have a stream/river polyline layer that contains lake "centerlines", and I place a "lake" polygon layer above it in the drawing order, I don't want the river layer to place a label inside the lake. Instead, I would rather have the river labeled outside of the lake (as needed). That way, I can place labels from the lakes layer and I don't run into label collisions.

Here is an example, where (I have intentionally put the lines on top for visual purposes) what I am hoping to achieve is no river center-line labels shown inside the lake polygon:
Lines are labeling inside polygon

Best Answer

In QGIS >= 2.12 you can set the "lake" polygon layer as a label obstacle. This is done through the layer properties of the "lake" layer, under the 'Labels' section. Change the combo box at the top from "No labels" to "Discourage other labels from covering features in this layer".

Related Question