karlkliparchuk

problem with ApplySymbologyFromLayer_management not applying symbology

Discussion created by karlkliparchuk on Feb 27, 2013
Latest reply on Dec 17, 2014 by mshukunobe
I am running ArcGIS v10.1. Here is a snippet of my arcpy code.  I am trying to apply symbology to point features.  The layer to display and my symbology layer both have the attribute "DESCRIPT" to match to.  I can apply the symbology manually in ArcMap, but when I try this code, it does not do it, even with a screen refresh.  Any ideas as to the problem?  The screen capture shows the layer added to the top of the TOC.

Thanks.
Karl
_______________

layerName = "crime_95"
outFeature = "crimejoinKK.shp"
crimeLayer = "crimejoinLayer"
symbologyLayer =  r"C:\temp\CrimeTypes.lyr"
crimeType = "CrimeTypes"


#Process: Copy layer
# Copy the crime layer to a new permanent feature class
arcpy.CopyFeatures_management(layerName, outFeature)


# First, Add Field - need to add a field that will match the field in the symbology layer
arcpy.AddField_management(outFeature, "DESCRIPT", "TEXT")
# Then Calculate Field - calculate the field with the crime descriptions
arcpy.CalculateField_management(outFeature, "DESCRIPT", "[crime95d_9]", "VB", "")
# Make a temporary layer to apply the symbology to
arcpy.MakeFeatureLayer_management(outFeature, crimeLayer)

#BELOW IS WHERE THE PROBLEM IS.
#I am adding crimeLayer to the data frame, then applying symbology to it.
#The point symbols show up, but not the symbology applied to them.

addCrimeLayer = arcpy.mapping.Layer(crimeLayer)
df = arcpy.mapping.ListDataFrames(mxd, "New Data Frame")[0]
arcpy.mapping.AddLayer(df, addCrimeLayer, "TOP")
arcpy.ApplySymbologyFromLayer_management(addCrimeLayer, symbologyLayer)
arcpy.RefreshActiveView()

----------
[ATTACH=CONFIG]22229[/ATTACH]

Outcomes