Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

SaveToLayerFile_management accepts only features save on disk

$
0
0
I'm trying to use SaveToLayerFile_management to save layers (in an mxd) pointing to features in the server "Internet", but it doesn't work

When I use ArcToolbox (SaveToLayerFile) it doesn't work neither. However, I can save it manually by right-clocking on the feature and save it as...

Is there a Python command that allowes me to save such layers? If it's not possible, how can I skip those layers and save the rest of the layers in the mxd file?

This is my code:
Code:

    for lyr in lyrs:
        l_name = lyr.longName
        layer_name = l_name.replace("_"," ")
        layer_name = layer_name.replace("\\","_")
        arcpy.SaveToLayerFile_management(lyr,ws + '\\' + layer_name + '.lyr', "RELATIVE")

Thank you

Viewing all articles
Browse latest Browse all 2485

Trending Articles