6

Is it possible to select individual features of a layer on a map and hide them? (I am working with 3.8.3-Zanzibar version of QGIS).

I need to print different maps of a close by area and I want to show only the symbols that are relevant in each case, but not others close by.

In the example below, I have selected the points (in yellow) that I would like to momentarily hide.

enter image description here

I know I could add a column in the associated table with a numeric field and fill in the ones I need to show with 1, the rest with 0 and then apply a filter. But I was looking for something more direct, like the show/hide label button.

5
  • Put them on a different layer, or classify the data and turn different classes on/off.
    – Erik
    May 7, 2020 at 8:48
  • If there few of those maps have to be produce than try a Filter? Otherwise I will suggest to work around with an Atlas in Print Composer.
    – Taras
    May 7, 2020 at 9:36
  • Thanks Erik and Taras, but my question was trying to avoid both suggestions: I didn't want to create more layers for only a print screen that takes a second. The Filter solution is how I am working at the moment: I select the items I want to show, update column of the selected ones, then filter, then print screen, and move on (which implies, unfilter, clear selection update column again, etc...). That's why I was just looking for a simple button.
    – Pescariz
    May 7, 2020 at 9:56
  • 1
    Does this question help? gis.stackexchange.com/questions/322070/…
    – she_weeds
    May 7, 2020 at 10:00
  • Looks also similar to this : gis.stackexchange.com/questions/414379/…
    – Taras
    Feb 2, 2023 at 18:23

3 Answers 3

5

It's not the cleanest but you can just set the symbology size to 0 if the feature is selected to "hide" it.

expression -> if(is_selected(), 0, 4)

enter image description here enter image description here

3
  • 1
    I recommend you use open source ShareX for screen casting: getsharex.com (It does not insert the logo). Feb 2, 2023 at 12:14
  • @ComradeChe Thanks it does look better
    – Kalak
    Feb 2, 2023 at 13:01
  • Thanks as well @ComradeChe - used the software for an animated gif as well, works nice and is intuitive to use.
    – Babel
    Feb 2, 2023 at 13:11
5

This can be achieved using Rule based symbology with a rule based on is_selected() function and a symbol layer which is not enabled - see below for details.

Selected features disappear visually, but appear again when deselected: enter image description here

Change layer rendering from Single Symbol to Rule-based and define two styles:

  • The first one with the rule not is_selected() that shows the points that are not selected. Style it as you like the points to appear.
  • The second one with the rule is_selected(). Double click on the rule, select the marker icon and at the very bottom, uncheck the box Enable symbol layer: like this, all selected features will not be displayed any more.

enter image description here

1
  • 1
    Yep that is definitely cleaner +1
    – Kalak
    Feb 2, 2023 at 13:04
1

For this kind of tasks, I used the Auto filtre 3 plugin.

Description translated from the plugin's page :

This plugin allows you to filter the active layer with the objects selected geographically automatically or by attribute and to log the filters to return to the previous one

Unfortunately, this plugin is only available in French but there might be an English alternative but I'm not aware of it. However, the use of the plugin is easy even if it's not translated.

enter image description here

There is two different types of filter available after selecting some entities you want to hide (or keep, depending on the situation), by id or by attribute.

By id, the plugin will automatically create a new filter on the layer (reseau in my example) to keep all the selected entities :

cast("id_res" as text) IN ('11233','11612')

By field, the plugin will create a new filter matching the values of the selected field (in Champ 1, Champ 2 and Champ 3) of the selected entities :

type IN ('ROAD','RIVER')

You can combine up to three fields in the same filter.

This two method allows you to keep the selected entities but if you want to hide them, just change the filter by replacing IN by NOT IN.

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.