1

I have a layer where shapes are defined by rules (country) and secondly by categories (a type). I then select (check box) the country to show the shapes only for that country. This works very well, as I change them on each composer and display data relevant to that country. The problem is with the labels: they show up for all countries all the time and I cannot hide them.

Does anyone know how to make QGIS label only the shapes that are showing up?

enter image description here

1
  • Tested on 2.8.3: same problem.
    – jfarjona
    Aug 5, 2015 at 16:11

2 Answers 2

3

What version of QGIS are you using?

I'm using 2.8 and I can style a layer by 'name' and also label it, and then turn off one of the features in the layer with a checkbox in the legend, and it isn't labelled any more.

Brighton added and labelled.

Brighton removed and not labelled.

2
  • 2
    Thanks much Alex. I am using QGIS 2.10.1. I have rule-based classification and then under it, I have made a category (see the image I just added). If I have only one level, then it work as it works for you, but with two levels it shows the labels always... is that a bug?
    – jfarjona
    Aug 5, 2015 at 15:35
  • 1
    Hi @jfarjona, sounds like a bug. Probably best reporting it here with a simple to reproduce case: hub.qgis.org/projects/quantum-gis/issues
    – Alex Leith
    Aug 6, 2015 at 2:24
1

In QGIS 2.8 and 2.10 (maybe in earlier versions as well, can't check right now) there is an option in the Label-Settings to define which feature will be labeled. You can enter these settings as shown in the screenshot below. There you can build a query adjusting to your needs.

enter image description here

2
  • Thanks, this could be a way. Do you know in which variable is recorded if the current polygon is being shown?
    – jfarjona
    Aug 5, 2015 at 15:38
  • I'm not sure if there is a variable for that. Maybe you can build a query using country and type like you aldready do for the classification. Then you would have to enter some values, e.g. "country"='Argentina' to adjust the labels to your current display, but this seems like a very un-elegant way to do this :/ has anyone else some ideas?
    – user14956
    Aug 7, 2015 at 6:39

Your Answer

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

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