I have a few thousand polygons (all square) that I need to rotate to various angles that are in the attribute table, and then move so that each polygon gets moved 3/4 up from the original centroid, which I have as a point shapefile. It would look like this:

enter image description here

Ideally, I would like to build a model for this process so I can repeat it in the future. I am not all that comfortable with Python, but if that is the only way to get the desired result, I will be willing to try it. I have arcGIS 10 with an ArcView license.

  • 1
    You may want to look at ETGeoWizards. There is a tool called rotate shapes. It may not do exactly what you are looking for, but there are a lot of good options. I will rotate based on a value in the polygon attribute table. You may need to do some calculations to get the exact value you need. Jul 30 '13 at 19:56
  • 1
    possible duplicate of Rotate features in ArcGIS 10
    – Fezter
    Jul 31 '13 at 0:36
  • The duplicate identified by @Fezter covers off on most of this question's requirements but not the "how to work out where the rotation point should be" so I recommend that this question be edited to focus on just that part.
    – PolyGeo
    Jul 31 '13 at 2:07
  • @RyanGarnett So I tried the rotate shapes tool from ETGeoWizards, but it seems like it can only rotate all shapes to one rotation angle that must be entered as opposed to pulling rotation angles from the attribute table. Can you tell me where this option is, if it exists? Thanks! Aug 2 '13 at 0:37
  • I'm sorry I dont understand your question. If you have three records in an attribute, and each of the records have different values, they will be rotated based on that value. Have you looked at the rotation options? Aug 2 '13 at 1:07

I did this using a python script and numpy to help me with the matrix algebra for rotation and translation of every point.

Here is the key function. You have to unpack the vertices from the feature, transform and reassemble the feature.

import arcpy
import math
import numpy

def trans(px,py,tx,ty,angle):
    Rotate a point px,py around origin 0,0
    Sense clockwise or anticlockwise
      (default clockwise)
    Transform to plot coords tx,ty
    Does not handle z or m values
    # angle in degrees +/- 360
    th = math.radians(angle) # theta (radians)
    if sense == 'anticlock':
        matrix = [[math.cos(th),-math.sin(th),tx],
                  [ math.sin(th), math.cos(th),ty],
    elif sense == 'clock':
        matrix = [[ math.cos(th),math.sin(th),tx],
        raise Exception, "sense error in DrawPlotR"
    a = numpy.array(matrix)
    b = numpy.array([px,py,1])
    c = numpy.dot(a,b)
    return (c[0],c[1])

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.