Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You need

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

and you can use the expression in the string:

layer.setCustomProperty("labeling/fieldName", "concat(ErrorDescr, Markerid)")
share|improve this answer
    
Thanks Nathan Its working fine. How to add a separator like - , / between ErrorDescr and Markerid? –  venkat May 20 '13 at 11:46
    
concat(ErrorDescr,'-', Markerid) –  Nathan W May 20 '13 at 11:50
    
Thanks a lot. its achieved my requirement –  venkat May 20 '13 at 12:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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