Skip to main content
formatting
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer.

Can someone tell me what I am doing wrong?

This did work a few days ago for other layers but is no longer working.

This is the script, path names modifiied

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer) arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":

addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd")

df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer)
arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":
   addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer

I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer.

Can someone tell me what I am doing wrong?

This did work a few days ago for other layers but is no longer working.

This is the script, path names modifiied

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer) arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":

addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer

I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer.

Can someone tell me what I am doing wrong?

This did work a few days ago for other layers but is no longer working.

This is the script, path names modifiied

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd")

df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer)
arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":
   addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer
edited body; edited tags; edited title
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

arcpy.mapping applying Applying graduated color symbology using arcpy.mapping?

I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer. 

Can someone tell me what I am doing wrong?

This did work a few days ago for other layers but is no longer working...

This is the script, path names modifiied

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer) arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":

addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer

arcpy.mapping applying graduated color symbology

I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer. Can someone tell me what I am doing wrong?

This did work a few days ago for other layers but is no longer working...

This is the script, path names modifiied

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer) arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":

addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer

Applying graduated color symbology using arcpy.mapping?

I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer. 

Can someone tell me what I am doing wrong?

This did work a few days ago for other layers but is no longer working.

This is the script, path names modifiied

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer) arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":

addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer

Source Link

arcpy.mapping applying graduated color symbology

I am trying to apply a graduated color symbology from one layer to another. The script adds a layer to an mxd but foes not apply the symbology from the symbology layer. Can someone tell me what I am doing wrong?

This did work a few days ago for other layers but is no longer working...

This is the script, path names modifiied

import arcpy

arcpy.env.workspace = r"C:\Workarea\BrandiS"

mxd = arcpy.mapping.MapDocument(r"C:\Workarea\BrandiS\SymbolTest.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

featureLayer = r"C:\Workarea\BrandiS\TestLayer.lyr"

addLayer = arcpy.mapping.Layer(featureLayer) arcpy.mapping.AddLayer(df, addLayer, "TOP")

if addLayer.symbologyType == "GRADUATED_COLOR":

addLayer.symbology.valueField = "Join_Count"

symbolLayer = r"C:\Workarea\BrandiS\SymbolLayer.lyr"

arcpy.mapping.UpdateLayer(df, addLayer, symbolLayer)

mxd.save()

del mxd, df, featureLayer, addLayer, symbolLayer