POST
|
Hi Is there any python script to list all the layers within a mxd (ListLayer function) and export the list to a CSV file?
... View more
12-03-2012
05:08 PM
|
0
|
1
|
768
|
POST
|
Thank you that worked. I also got the following form ESRI Australia which worked perfectley import arcpy import os mxdpath = arcpy.GetParameterAsText(0) outdir = arcpy.GetParameterAsText(1) mxd = arcpy.mapping.MapDocument(mxdpath) arcpy.env.workspace = outdir i = 0 for lyr in arcpy.mapping.ListLayers(mxd): outname = lyr.name if os.path.exists(outdir): outname = outdir + "\\" + outname i = 0 out_i = outname + ".lyr" print out_i while os.path.exists(out_i) and i < 10: out_i = outname + "_" + str(i) + ".lyr" i += 1 outname = out_i lyr.saveACopy(outname)
... View more
08-19-2012
08:08 PM
|
0
|
0
|
287
|
POST
|
Thank you for the quick reply I tried the script but nothing happens! I have also tried the following script, which didn't work! import arcpy ws = arcpy.env.workspace(r"M:\SIS\ArcGIS Workspace\GIS_Project_lyrs\Dekho\lyrs\Test") mxd = arcpy.mapping.MapDocument("CURRENT") dframes = arcpy.mapping.ListDataFrames(mxd) for dframe in dframes: lyrs = arcpy.mapping.ListLayers(mxd,'',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') The mxd only has one datafram and I certainly need grouped layers as well as individual layers. Would appreciate your help. Thanks
... View more
08-16-2012
03:26 PM
|
0
|
0
|
287
|
POST
|
Hi, I have this big mxd containing 400+ layers under different groups. I was wondering if there is any python scripting to save all the layers to the layer files. Regards Razi
... View more
08-15-2012
09:26 PM
|
0
|
4
|
667
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|