Créer un arc de fichier de couche
arcpy.management.SaveToLayerFile(in_layer, out_layer, {is_relative_path}, {version})
Bohemian Unicorn
arcpy.management.SaveToLayerFile(in_layer, out_layer, {is_relative_path}, {version})
# Name: SaveToLayerFile_Example2.py
# Description: Saves an inMemory layer to a file on disk
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/data"
# Set local variables
in_features = "study_quads.shp"
where_clause = '"NAME" = \'LA MESA\''
in_layer = "studyquadsLyr"
out_layer_file = "studyquadsLyr.lyr"
# Execute MakeFeatureLayer
arcpy.MakeFeatureLayer_management(in_features, "study_quads_lyr", where_clause)
# Execute SaveToLayerFile
arcpy.SaveToLayerFile_management("study_quads_lyr", out_layer_file, "ABSOLUTE")
import arcpy
arcpy.env.workspace = "C:/data"
arcpy.SaveToLayerFile_management("studyquads.shp", "C:/output/studyquadsLyr.lyr", "ABSOLUTE")