list = [] # Specify feature class whose features you want to rotate # Append to list to find the Max OBJECTID/FID lstFCs = arcpy.ListFeatureClasses("Parcels") for fc in lstFCs: rows = arcpy.SearchCursor(fc) for row in rows: list.append(row.OBJECTID) del row, rows maxOID = list[-1] x = 1 y = 1 # Loop through each feature, convert to a feature layer, then to raster, rotate raster, convert back to polygon feature class while y <= maxOID: for fc in lstFCs: feat_lay = arcpy.MakeFeatureLayer_management(fc, fc + str(x), "OBJECTID = " + str(x)) ras_lay = arcpy.PolygonToRaster_conversion(feat_lay, "OBJECTID", fc + str(x) + "_ras") # Can improve processing time by specifying a larger cell size feat_lay2 = arcpy.Rotate_management(ras_lay, "ras_rotate" + str(x), 45) arcpy.RasterToPolygon_conversion(feat_lay2, fc + "_rotate_" + str(x)) y = y + 1 x = x + 1 # Print extent of rotated feature classes lstFCs2 = arcpy.ListFeatureClasses("*rotate*") for fc2 in lstFCs2: rows2 = arcpy.SearchCursor(fc2) for row2 in rows2: geom = row2.Shape Extent = geom.extent print Extent del row2, rows2 # Deleted rasters lstRasters = arcpy.ListRasters("*ras*") for raster in lstRasters: arcpy.Delete_management(raster)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.