fc = arcpy.GetParameterAsText(0) arcpy.MakeFeatureLayer_management(fc, arcpy.Describe(fc).name + "_test")
test_lyr = arcpy.Describe(fc).name + "_test" mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] # choose the correct DataFrame lyr = arcpy.mapping.Layer(test_lyr) # insert your layer-name arcpy.mapping.AddLayer(df, lyr, "TOP") # choose position in TOC arcpy.RefreshTOC()
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.