0

Annotations that are linked to the source entity possess an attribute table within which you find a "TextString" column, containing the text displayed by the annotation.

If the content of the column is changed manually within ArcGIS Pro GUI, the displayed text changes accordingly. But, when done with arcpy, the "TextString" cell content is updated but the text displayed in the map stays the same. This problem is described here too : https://community.esri.com/thread/206173-can-i-change-annotation-expression-using-arcpy

Has anyone worked his way around this ?

(Specifics of my case : I need them to be annotations and not labels, and I need to update the annotation content, and can not just get the text right from the label formula.)

asked Apr 20, 2018 at 15:48

1 Answer 1

1

If I understand the problem right. You have linked database annotation. You are trying to change the value of the annotation using the TextString column of the annotation table. I assume you are using the arcpy.da.UpdateCursor method. In order to get this to work you need to start an editing operation.

Example:

edit = arcpy.da.Editor(path to geodatabase holding annotation class)
edit.startEditing(False,False)
edit.startOperation()
#begin your text string update
with arcpy.da.UpdateCursor(annotation feature class,["TextString"]) as uc:
 for row in uc:
 row[0] = row[0] + " 5"
 uc.updateRow(row)
edit.stopOperation()
edit.stopEditing(True)
answered Apr 20, 2018 at 19:23
2
  • Thanks for your answer ! However, I get a RunTimeError "workspace already in transaction mode" when I try to update my values. Commented Apr 23, 2018 at 7:55
  • My bad, it works like a charm. Answer accepted. Commented Apr 23, 2018 at 8:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.