2

In my case I would like to copy and move a polygon from one location to the next using 2 parameters; angle and distance. I know i can do this programmatically, just wondering if there is an out-of-the-box tool for this.

I am using ArcGIS 10.3.1 Standard with Spatial Analyst and 3D Analyst

3
  • There is no geoprocessing or edit tool that I know of that will do what you want out of the box. I am fairly sure you have to program it, unless you can find a 3rd party add-in, like ET Geowizards, that does it. However, I did not see anything that would do what you want listed with the free ET Geowizard tools. Commented Nov 30, 2015 at 19:31
  • Fair enough, wanted to double check before I write my own. Can you please make your comment an answer? Commented Nov 30, 2015 at 19:34
  • 2
    You can always reproject the feature: change the false easting and false northing of the projection by the negatives of the amounts you wish to displace the x and y coordinates. Although a little cumbersome, it's certainly an out-of-the-box solution.
    – whuber
    Commented Nov 30, 2015 at 19:56

3 Answers 3

2

It's not bad

import arcpy
from math import pi, sin, cos

def DtoR(deg):
    rad = deg*(pi/180.0)
    return rad

def MovePolygon(shape, angle, distance):
    newshape = arcpy.Array()
    for part in shape:
        newpart = arcpy.Array()
        for point in part:
            newX = point.X + cos(DtoR(float(angle)))*float(distance)
            newY = point.Y + sin(DtoR(float(angle)))*float(distance)
            newpoint = arcpy.Point(newX, newY, point.Z, point.M, point.ID)
            newpart.add(newpoint)
        newshape.add(newpart)
    return arcpy.Polygon(newshape)

fc = r"--system path to FC--" # E.g. C:\MyGDB.gdb\MyFC
angle = 45 # Angle in degrees
distance = 1000 # Distance in native spatial reference units
# You can find it by: arcpy.Describe(fc).spatialReference.linearUnitName

with arcpy.da.UpdateCursor(fc, "SHAPE@") as cursor:
    for row in cursor:
        cursor.updateRow((MovePolygon(row[0], angle, distance),))

Edit: Make sure you're in a projected coordinate system. Also, doesn't work when you have true curves (circular arcs, ellipses, Bezier curves) in the polygon.

1

There is no geoprocessing or edit tool that I know of that will do what you want out of the box. I am fairly sure you have to program it, unless you can find a 3rd party add-in, like ET Geowizards, that does it. However, I did not see anything that would do what you want listed with the free ET Geowizard tools

0

The way I would do this without programming would take a few steps.

1. Create a new Point Feature Class
2. Choose a easily found corner or feature (the reference feature).
3. Using the "Point at end of line" tool and the right click menu of the feature creation tool, set the angle and distance of the new feature from the reference feature, which creates a point where you want the reference feature to be after the move.
4. Edit the Features you want to move.  Use the edit cursor, select them all, move the 'snapping base point' to over top the reference feature, and move everything to the new feature you just created.

The new feature class could also be a Line feature class instead of a point. Same process either way. I suppose this might be straightforward to implement as an Add-in...

Your Answer

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

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