I have an attribute field [NOTE] that contains very long strings - often 255 characters - usually consisting of multiple sentences.

I'd like to be able to use ArcMap's MapTips with some form of wrapping, because without it the MapTip text usually runs off of the map pane, obscuring important parts of the note.

Is it possible to do this in the Advanced box using the Python parser? I

tried variations of a python function textwrap.wrap([NOTE]) to no avail.

enter image description here


This is a bit crude but will do the job...I'm sure someone will be able to produce some more efficient Python code. It would obviously be better to wrap at a space rather than the middle of the word but this demonstrates that the concept is possible.

def FindLabel ( [Note] ):
  txt = [Note]
  txtList = []
  return "\n".join(txtList)

enter image description here enter image description here

| improve this answer | |
  • 1
    This is similar, not limited to 255 though, n = 50 txt = [Note] textList = ([txt[i:i+n] for i in range(0, txt(line), n)]) return "\n".join(txtList) – JamesLeversha Nov 14 '18 at 21:25
  • I had to make one change to James' comment to get it to work... txtList = ([txt[i:i+n] for i in range(0, len(txt), n)]) – Dan Jun 24 '19 at 2:38

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.