I'm having some trouble starting this script. Not sure how to start, as I have to create/output layers for each attribute value from a certain column named that has integers. They are all unique values.
My first thought was to somehow use MakeFeatureLayer but then again, how do you create the layers without making countless of local variables with layer name.
Another idea would be to use the SearchCursor to iterate each value, and place a layer for each but then again how would I do that.
Looking forward to some suggestions.
import arcpy from arcpy import env #environnement de travail env.workspace = "D:/M1 Geomatique/Programmation II/Dossier" #variables locales in_features = "ELYTR_TR_BUREAU_VOTE_2015_polygon.shp" field = "CODE_SECTE" with arcpy.da.SearchCursor(in_features, field) as cursor: for row in cursor: name = row to_output = arcpy.SelectLayerByAttribute_management(row) arcpy.MakeFeatureLayer_management(to_output, name)
Getting a RuntimeError: Error in executing tool, but this most likely due to not using SelectLayer and MakeFeatureLayer properly, I guess the order is not good, but then again the input for the MakeFeatureLayer is not good.