Skip to main content
added 53 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

I could manage to do this by the help of: httpsArcPy (ArcMap)://gist.github.com/bixb0012/dfddcd1142b31b2986cc9feb155d4564 Modify Layer Symbology, Expanded. But i'mI'm still interested about the normal approach

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")

lyr =arcpy.mapping.ListLayers(mxd, "LayerName")[0] # Layer object, typically 
from arcpy.mapping.ListLayers (arcpy._mapping.Layer)

# Example 1a: Modifying single-field renderer using undocumented _arc_object.renderer
old_field = "JOINEDTABLENAME.GRAFIKA" # New field name for 
symbolizing layer
new_field = "FeatureClassname.GRAFIKA" # Old field name for symbolizing layer 

sym_xml = lyr._arc_object.renderer
lyr._arc_object.renderer = sym_xml.replace(old_field, new_field)
arcpy.RefreshActiveView()

I could manage to do this by the help of: https://gist.github.com/bixb0012/dfddcd1142b31b2986cc9feb155d4564 But i'm still interested about the normal approach

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")

lyr =arcpy.mapping.ListLayers(mxd, "LayerName")[0] # Layer object, typically 
from arcpy.mapping.ListLayers (arcpy._mapping.Layer)

# Example 1a: Modifying single-field renderer using undocumented _arc_object.renderer
old_field = "JOINEDTABLENAME.GRAFIKA" # New field name for 
symbolizing layer
new_field = "FeatureClassname.GRAFIKA" # Old field name for symbolizing layer 

sym_xml = lyr._arc_object.renderer
lyr._arc_object.renderer = sym_xml.replace(old_field, new_field)
arcpy.RefreshActiveView()

I could manage to do this by the help of: ArcPy (ArcMap): Modify Layer Symbology, Expanded. But I'm still interested about the normal approach

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")

lyr =arcpy.mapping.ListLayers(mxd, "LayerName")[0] # Layer object, typically 
from arcpy.mapping.ListLayers (arcpy._mapping.Layer)

# Example 1a: Modifying single-field renderer using undocumented _arc_object.renderer
old_field = "JOINEDTABLENAME.GRAFIKA" # New field name for 
symbolizing layer
new_field = "FeatureClassname.GRAFIKA" # Old field name for symbolizing layer 

sym_xml = lyr._arc_object.renderer
lyr._arc_object.renderer = sym_xml.replace(old_field, new_field)
arcpy.RefreshActiveView()
Source Link

I could manage to do this by the help of: https://gist.github.com/bixb0012/dfddcd1142b31b2986cc9feb155d4564 But i'm still interested about the normal approach

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")

lyr =arcpy.mapping.ListLayers(mxd, "LayerName")[0] # Layer object, typically 
from arcpy.mapping.ListLayers (arcpy._mapping.Layer)

# Example 1a: Modifying single-field renderer using undocumented _arc_object.renderer
old_field = "JOINEDTABLENAME.GRAFIKA" # New field name for 
symbolizing layer
new_field = "FeatureClassname.GRAFIKA" # Old field name for symbolizing layer 

sym_xml = lyr._arc_object.renderer
lyr._arc_object.renderer = sym_xml.replace(old_field, new_field)
arcpy.RefreshActiveView()