3

I am using a python code in ArcGIS to define the size of the labels of a point feature class. Therefore I am using a label expression (Maplex). The label size of the TEXTSTRING (string) should be defined by the TEXT_SIZE (double, with values like "3,5"). Generally the code is working, but not with special german characters (ü,ä,ö).

The code looks like that:

  def FindLabel ( [TEXTSTRING], [TEXT_SIZE] ):
      size = str([TEXT_SIZE])
      size_rec = str(float(size.replace(",","."))*4)
      size = size_rec.replace(".",",")
      return "<FNT size = '{0}'>{1}</FNT>".format(size, [TEXTSTRING])

Labels with these special characters are not displayed, labels with "normal" characters are displayed and sized correctly. Any ideas?

enter image description here

  • 1
    Try something like this : "<FNT size = '"+size+">"+[TEXTSTRING]+"</FNT>" – user7172 Feb 18 '16 at 9:41
  • the special characters then are displayed on the screen, but the size is not adapted correctly and i get the label: "<FNT size = '14,0>NAMEOFSTRING</FNT> instead of just the string... – Duddel Feb 18 '16 at 10:40
1

From comment

Try something like this :

"'<FNT size = '"+size+">"+[TEXTSTRING]+"</FNT>" 

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.