I have the following function:
def ecoclip_reclass(input_fc, clip_fc, name):
# Create a list to store the paths of the clipped feature classes
clipped_feature_classes = []
# Create a search cursor for the clip feature class
with arcpy.da.SearchCursor(clip_fc, ["SHAPE@", "OID@"]) as cursor:
for row in cursor:
# Extract the geometry and OID of each record
clip_geometry = row[0]
clip_oid = row[1]
# Set the output feature class name based on the clip OID
output_feature_class = os.path.join(output_workspace, f"{name}_Eco_{clip_oid}")
# Perform the clip operation
arcpy.management.Clip(input_fc, "", output_feature_class, clip_geometry, "255",
"ClippingGeometry")
# Add the path to the clipped feature class to the list
clipped_feature_classes.append(output_feature_class)
I would like to add to this function so that it checks to make sure the raster dataset being clipped and the polygon it’s being clipped to overlap before performing the clip.
Any help would be greatly appreciated.