[QGIS-Developer] How to tur off "Discourage other labels from covering features in this layer"

Tao Lu hakufu.asano at gmail.com
Sat Jun 24 18:29:21 PDT 2017


Hello

I am writing a plugin to create label.
Sample code like below
        # parameters for advanced labeling -- picked up from a qgs model
file
        # generic labeling propertiesNo Labels
        layer.setCustomProperty("labeling/fieldName",  'No Labels')
        layer.setCustomProperty("labeling/fieldName",
share.field_list[0][0])  #[0][0] )
        layer.setCustomProperty("labeling","pal" ) # new gen labeling
activated
        layer.setCustomProperty("labeling/fontSize","9" ) # default value
        layer.setCustomProperty("labeling/multiLineLabels","true" ) #
default value
        layer.setCustomProperty("labeling/enabled","true" ) # default value
        # layer.setCustomProperty("labeling/displayAll", "true") # force
all labels to display
        layer.setCustomProperty("labeling/priority", "10") # puts a high
priority to labeling layer
        layer.setCustomProperty("labeling/multilineAlign","1") # multiline
align to center
        # layer.setCustomProperty("labeling/wrapChar", "%") # multiline
break symbol
        # line properties case
        layer.setCustomProperty("labeling/placement","4" )

        # data defined properties
        layer.setCustomProperty("labeling/dataDefined/PositionX",
"1~~0~~~~" + share.field_list[1][0])
        layer.setCustomProperty("labeling/dataDefined/PositionY",
"1~~0~~~~" + share.field_list[2][0])
        layer.setCustomProperty("labeling/dataDefined/Rotation" ,"1~~0~~~~"
+ share.field_list[3][0])
        layer.setCustomProperty("labeling/dataDefined/Size" ,"1~~0~~~~" +
share.field_list[4][0])
        layer.setCustomProperty("labeling/dataDefined/Hali", "1~~0~~~~" +
share.field_list[5][0])
        layer.setCustomProperty("labeling/dataDefined/Vali","1~~0~~~~" +
share.field_list[6][0])

Everything goes well.
However sometimes, when I use this to create label, the label shows
"Discourage other labels from covering features in this layer"
Is there any method to force to label?

This is my codes:http://plugins.qgis.org/plugins/SuperLabeling/

Please help me.
Thank you very much.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170625/987bd1d9/attachment.html>


More information about the QGIS-Developer mailing list