BlackPixPoly = "BlackPixPoly.shp" arcpy.RasterToPolygon_conversion(BlackPixRast, BlackPixPoly, "SIMPLIFY") #delete black pixel polygons to leave non-black pixels arcpy.MakeFeatureLayer_management(BlackPixPoly, "BlackPixPoly_lyr") arcpy.SelectLayerByAttribute_management("BlackPixPoly_lyr", "NEW_SELECTION", "\"GRIDCODE\" = 0") arcpy.DeleteFeatures_management("BlackPixPoly_lyr")
Here is an extract of my script that converts a raster to polygons and then deletes the polygons that represent black pixels. The script has been used many times successfully but has hit a problem with a particular file. I get:
Failed to execute (DeleteFeatures)
For this particular file it is attempting to delete almost 1.2 million polygons - my guess is that this is the cause of the problem.
I tried DeleteRows (is there a difference?) but got the same problem.
I tried adding a line to RepairGeometry prior to deletion but get the same problem.
Is there something I can do to help it get through this task?