Add a rotate features method to arcpy allowing the angle and pivot coords to be specified

386
0
09-06-2023 11:51 PM
Status: Open
MattHowe
Occasional Contributor

I'm currently using geopandas to iterate through individual features in ArcGIS Pro and rotate them. It would be great if a method was added to arcpy where features could be rotated easily by specifying an angle, and a pivot point as a coordinate pair/tuple/point features. Something like:

 

arcpy.edit.Rotate(in_features, angle, origin, radians)

Example:

import arcpy
arcpy.env.workspace = "C:/data"

arcpy.MakeFeatureLayer_management("platforms.shp", "platforms_lyr", whereclause="WTG_ID = 'AB01'")

arcpy.edit.Rotate("platforms_lyr", 30, (123456.1, 5465646.10), radians=False)

# Else, use list comp and search cursors to grab the angles and coordinates of each row in the attributes.

 

With cursors, the angle and origin coordinates could be derived from a field in the in_features or hard coded etc.