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.)

0

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)
  • Thanks for your answer ! However, I get a RunTimeError "workspace already in transaction mode" when I try to update my values. – T Dog Apr 23 '18 at 7:55
  • My bad, it works like a charm. Answer accepted. – T Dog Apr 23 '18 at 8:16

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.