1

Trying to answer another question, I remarked that the QGIS expression function is_layer_visible() is missing in my expression editor. It should normally be located in the General group. It's not there and typing the name in the search/filter box above does not find any function.

A few hours before on another windows machine, it was available and worked perfectly. I am here on another win machine with the same QGIS version 3.28. I tried older versions as well (3.22, 3.18), with the same result.

As you can see on the screenshot, I can use the function without error message, but I get a wrong result: all layers are visible, but still is_layer_visible('layer_1') returns false.

Why is the function is_layer_visible() missing and how can I get it to work?

enter image description here

6
  • It seems for unknown reasons the expression does not exist either in the QGIS 3.22.13 or the QGIS 2.28.1. It is better to report this issue to the QGIS developer team, maybe there is a specific reason for removing the expression from the field calculator.
    – ahmadhanb
    Commented Dec 7, 2022 at 1:40
  • It is not that the function is missing in 3.28 completely: on one machine, it is available, on the other not - using the same version!
    – Babel
    Commented Dec 7, 2022 at 7:39
  • 2
    I've added an issue: github.com/qgis/QGIS/issues/51135
    – eurojam
    Commented Dec 7, 2022 at 8:49
  • 3
    the answer from the developer: To further explain: it's only available in contexts where the expression is directly associated with a particular map (or map canvas). So it's available in layout maps, and in symbology, but not in tools which aren't associated with any individual map like the "select by expression" tool. The issue is that if the user has multiple maps open then "is_layer_visible" no longer has any clear meaning.
    – eurojam
    Commented Dec 8, 2022 at 5:27
  • 1
    Thanks a lot @eurojam for the issue and clarifications. Thes indeed makes sense - maybe worth posting as an answer?
    – Babel
    Commented Dec 9, 2022 at 9:36

0

Your Answer

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