Jun-11-2017, 10:32 AM
How can I use select_analysis in a loop?
I need to select polygons one by one and create separate shapefiles from them.
I tried the following codes but I was not successful
I need to select polygons one by one and create separate shapefiles from them.
I tried the following codes but I was not successful
import arcpy # Local variables: This is the Grid Mapsheet_grid_50K = "Mapsheet_grid_50K" rows = arcpy.SearchCursor(Mapsheet_grid_50K) row = rows.next() while row: Expression = "[MAP_TILE] =str(row)" Mapsheet_grid_50K_Select_shp = "F:\\Canada_DSM_ForTestOnly\\PersonalData&Maps\\map_Tiles\\Mapsheet_grid_50K_"+ str(row)+".shp" arcpy.Select_analysis(Mapsheet_grid_50K, Mapsheet_grid_50K_Select_shp, Expression) row = rows.next()