import arcpy, arcpy.mapping ws = r'YOUR FILE PATH HERE TO WHERE LAYERS GET SAVED' mxd = r'FILE PATH TO YOUR MAP DOCUMENT HERE' mapdoc = arcpy.mapping.MapDocument(mxd) dframes = arcpy.mapping.ListDataFrames(mapdoc) for dframe in dframes: lyrs = arcpy.mapping.ListLayers(mapdoc,'',dframe) for lyr in lyrs: if lyr.isGroupLayer: l_name = 'group_' + lyr.name else: l_name = lyr.name arcpy.SaveToLayerFile_management(lyr,ws + '\\' + l_name + '.lyr')
mxd = arcpy.mapping.MapDocument("CURRENT")
ws = arcpy.env.workspace(r"M:\SIS\ArcGIS Workspace\GIS_Project_lyrs\Dekho\lyrs\Test")
arcpy.env.workspace(r"M:\SIS\ArcGIS Workspace\GIS_Project_lyrs\Dekho\lyrs\Test")
ws = r"M:\SIS\ArcGIS Workspace\GIS_Project_lyrs\Dekho\lyrs\Test" arcpy.env.workspace(ws)
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.