3

I'm relatively new to QGIS.

I added the hover labels to my map using the Map Tips. My issue is that it makes hover labels for EVERY layer on my map. I only want it to make labels for one layer.

Is there a way to fix this like assigning Map Tips to only apply to one layer?

1 Answer 1

4

I am rather new to QGIS as well so there may be a much better way to accomplish map tip suppression for individual layers:

Just made a quick test with v2.8.2 on Windows. From the "Display" page of the layer properties, setting the Map Tip to display to be a field filled with NULL values results in no map tip for that layer.

I also found if the map tip value is a python function that returns no value the map tip is suppressed. What I did:

  1. Open layer properties
  2. Select Display page
  3. Enable HTML and hit Insert expression... button
  4. Selecting Function Editor showed a scratch area with a template function that takes an argument, does nothing and does not return a value:

    from qgis.core import *
    from qgis.gui import *
    
    @qgsfunction(args="auto", group='Custom')
    def func(value1, feature, parent):
        pass
    
  5. Switch back to the Expression tab and enter func(1) in the expression editor and hit Ok to go back to the layer properties _Display" page. The value 1 is not important

  6. The HTML map tip display text should be set to [% func(1)%]

  7. Ok to close the layer properties dialog and test Map Tips for that layer. I do not have any on this layer.

Hope this of some help.

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.