I have two folders with shapefiles:r'E:\SO\Polygons' and r'E:\SO\Districs'
Within each folder I have 215 shapefiles named with similar naming conventions
oly_100 or dist_100. I need to clip the polygons by the districts if their ending digits are equal. I am new to python and at a loss:
#folder for clipped Voronio polygonsVoronio_file = str(maindir) + "/" + "Voronio_polygons"if not os.path.exists(Voronio_file): os.makedirs(Voronio_file)env.workspace = r'E:\SO\Polygons'outputworkspace= Voronio_filecount=0for fc in arcpy.ListFeatureClasses(): end1 = str(fc[4:]) env.workspace = r'E:\SO\Districs' for fc in arcpy.ListFeatureClasses(): end2 = str(fc[4:]) if end1==end2: out_name = str((outputworkspace) + "/" + "dis_poly" + str(count)) # Assemble the output point name and path arcpy.Clip_analysis(end1, end2, out_name) count = count + 1
أكثر...
Within each folder I have 215 shapefiles named with similar naming conventions
#folder for clipped Voronio polygonsVoronio_file = str(maindir) + "/" + "Voronio_polygons"if not os.path.exists(Voronio_file): os.makedirs(Voronio_file)env.workspace = r'E:\SO\Polygons'outputworkspace= Voronio_filecount=0for fc in arcpy.ListFeatureClasses(): end1 = str(fc[4:]) env.workspace = r'E:\SO\Districs' for fc in arcpy.ListFeatureClasses(): end2 = str(fc[4:]) if end1==end2: out_name = str((outputworkspace) + "/" + "dis_poly" + str(count)) # Assemble the output point name and path arcpy.Clip_analysis(end1, end2, out_name) count = count + 1
أكثر...