I have a series of polygons that I want to rotate.

Each polygon has a rotate angle and an anchor point (xy coordinate) stored as field values.

As it happens, all anchor points are on a vertex of the polygon.

What is the best way to do this using ArcGIS for Desktop and ArcPy?

I know we can rotate them when in editing mode, but I don't want to do them all manually since they are all different.

I would prefer a Python answer so I can automate it and build it into my work flow.

  • This is not something that I have done but you seem to be facing a similar issue to that discussed at gis.stackexchange.com/questions/13383/… – PolyGeo Apr 5 '12 at 1:22
  • You can do this with ArcObjects. Would programmatic solution be acceptable? – Jakub Sisak GeoGraphics Apr 5 '12 at 14:13
  • Are your features in geographic or projected coordinates? – blah238 Apr 5 '12 at 21:43
  • Jakub - yes, a programmatic solution would be preferred. Blah238 - projected coordinates (NAD 83 UTM Zone 10) – dklassen Oct 25 '13 at 21:21
  • 1
    In the Python script the calculation of the rotated Y coordinate needs a plus sign (addition) instead of the minus sign (subtraction): y_transprime = Sin(t) * x_trans + Cos(t) * y_trans – user23492 Oct 31 '13 at 11:10

Assuming you are using a projected coordinate system... (gets way more complicated if you are not)

Given point of rotation (X,Y) and rotation angle t, you need to rotate each point in the polygon in sequence. Assuming the polygon is built of points in set such that set = [(x0,y0), (x1,y1), (x2,y2)...]

You need to rotate each point in the set, in sequence, to form set' = [(x0',y0'), (x1',y1'), (x2',y2')...]

To rotate, first you have to transform the coordinate system to origin by moving the point of rotation to (0,0). (x,y) is the point to be rotated.

x_trans = x - X
y_trans = y - Y
x_transprime = Cos(t) * x_trans - Sin(t) * y_trans
y_transprime = Sin(t) * x_trans + Cos(t) * y_trans
x_prime = x_transprime + X
y_prime = y_transprime + Y

This should be pretty straightforward to translate into a python script.


Here is a discussion from the Esri Forums that may be a solution for you. Look for the Esri response. It involves converting the polygons to rasters, using the Rotate raster tool, and converting back to polygons. However, there may be some concern about the polygon boundaries getting messed up as you convert back and forth between raster/vector.

The good news is that it can all be done in Python without calling ArcObjects. And you should be able to use SearchCursor to grab your rotation angles and anchor points from the attribute table.

Anyway, just a possible alternative.

Not the answer you're looking for? Browse other questions tagged or ask your own question.