2

how to show the two field values as a label on features. I have done it for a field called "ErrorDescr" with this i need to show another field values. Other field is "MarkerId"

layer.setCustomProperty("labeling", "pal")
    layer.setCustomProperty("labeling/enabled", "true")
    layer.setCustomProperty("labeling/fontFamily", "Arial")
    layer.setCustomProperty("labeling/fontSize", "10")
    layer.setCustomProperty("labeling/fieldName", "ErrorDescr")
    layer.setCustomProperty("labeling/placement", "2")

is it possible to bring the output like this:

enter image description here

enter image description here

5

You need

layer.setCustomProperty("labeling/isExpression", True)

and you can use the expression in the string:

layer.setCustomProperty("labeling/fieldName", "concat(ErrorDescr, Markerid)")
  • Thanks Nathan Its working fine. How to add a separator like - , / between ErrorDescr and Markerid? – venkat May 20 '13 at 11:46
  • 1
    concat(ErrorDescr,'-', Markerid) – Nathan W May 20 '13 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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