Skip to main content
change new layer name
Source Link
Farid Cheraghi
  • 8.8k
  • 1
  • 24
  • 54

After adding the layer to the in-memory mxd, you should save the mxd using:

mxd.save()

or

mxd.saveACopy (r"D:/arcgisserver/directories/my_mxd2.mxd")

to change the layer name, simply change the name property of the layer:

addLayer.name = "NewLayerName"

Update: To rename the newly added layer you should make a reference to the layer first:

allLayers= arcpy.mapping.ListLayers(mxd, "", df)
copiedLayer = allLayers[len(allLayers)-1]  //because it is added to the bottom of TOC
copiedLayer.name = "NewLayerName"

After adding the layer to the in-memory mxd, you should save the mxd using:

mxd.save()

or

mxd.saveACopy (r"D:/arcgisserver/directories/my_mxd2.mxd")

to change the layer name, simply change the name property of the layer:

addLayer.name = "NewLayerName"

After adding the layer to the in-memory mxd, you should save the mxd using:

mxd.save()

or

mxd.saveACopy (r"D:/arcgisserver/directories/my_mxd2.mxd")

to change the layer name, simply change the name property of the layer:

addLayer.name = "NewLayerName"

Update: To rename the newly added layer you should make a reference to the layer first:

allLayers= arcpy.mapping.ListLayers(mxd, "", df)
copiedLayer = allLayers[len(allLayers)-1]  //because it is added to the bottom of TOC
copiedLayer.name = "NewLayerName"
Source Link
Farid Cheraghi
  • 8.8k
  • 1
  • 24
  • 54

After adding the layer to the in-memory mxd, you should save the mxd using:

mxd.save()

or

mxd.saveACopy (r"D:/arcgisserver/directories/my_mxd2.mxd")

to change the layer name, simply change the name property of the layer:

addLayer.name = "NewLayerName"