arcpy.MakeFeatureLayer_management(fc, fc)
arcpy.env.workspace = '#whatever the folder is' mxd = arcpy.mapping.MapDocument("Current") fclist = arcpy.ListFeatureClasses() for i, fc in enumerate(fclist): arcpy.CreateFeatureLayer_management(fc, "layer_%i" % i)
That doesn't work either. Not sure why not it always brings up an error.
arcpy.env.workspace = 'C:\\GIS_DATA\\' # or r 'C:\GIS_DATA\' mxd = arcpy.mapping.MapDocument("Current") fclist = arcpy.ListFeatureClasses() for i, fc in enumerate(fclist): arcpy.CreateFeatureLayer_management(fc, "layer_%i" % i)
I am using shapefiles, does that matter?
arcpy.env.workspace = 'C:\\GIS_DATA\\' # or r 'C:\GIS_DATA\' mxd = arcpy.mapping.MapDocument("Current") fclist = arcpy.ListFeatureClasses() i = 0 for fc in fclist: i += 1 arcpy.CreateFeatureLayer_management(fc, "layer_%i" % i)
arcpy.env.workspace = "WORKSPACE" mxd = arcpy.mapping.MapDocument('CURRENT') fclist = arcpy.ListFeatureClasses() for fc in fclist: name = fc.split(".") #Splits the .shp from the name arcpy.MakeFeatureLayer_management(fc,name[0])
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.