Select to view content in your preferred language

Python Script for Moving Annotated layers

247
1
12-05-2025 08:51 AM
Labels (1)
HaileyTimmons
Occasional Contributor

Hi,

I am looking for some help writing a Python script to move my annotated layers outside of the buffer zone and to make them not overlap.

Any help is appreciated on this.

Thank you!

0 Kudos
1 Reply
AlfredBaldenweck
MVP Regular Contributor

I think you're going to need to give us a little more information to properly help you.

Do you have anything so far?

 

That being said, this was awful and I did not have a good time. This will probably help a little bit but you'll have to tweak for your usecase. I'd take a look at the Geometry methods for more ideas. It looks like the annotations come in natively as lines, so pay close attention to the polyline page.

import arcpy
fc = r"path to anno"
dX = -2000
dY = 2000
with arcpy.da.UpdateCursor(fc, ["ANNO@"]) as cursor:
    for row in cursor:
        graph = row[0].getGraphic('V3')
        newshp = newshp.move(dX,dY)
        graph.shape = newshp
        row[0].setGraphic(graph)
        cursor.updateRow(row)

 

0 Kudos