I'm trying to create a python script that creates color-coded symbology by county for multiple maps with different data. I've never created a layer file for the purposes of symbology before, but I figured you simply had to save the layer. However, every time I run by script, no symbology is visible. Is there a way to automate symbology that I'm missing? Thanks!

    # Process: Add Join
    arcpy.AddJoin_management(Map_Lyr, "CNTYIDFP", selected_input, "FIPS", "KEEP_COMMON")

    #Process: Make Feature Layer
    arcpy.MakeFeatureLayer_management(Map_Lyr, lyr_again)

    #Process: Add Symbology
    arcpy.ApplySymbologyFromLayer_management(lyr_again, symbol_lyr)

    # Save to Layer File
    arcpy.SaveToLayerFile_management(lyr_again, Final_Product, "", "CURRENT")
  • I recommend that you take a step back from presenting your whole script and asking for help debugging it, and instead, just post a code snippet from it that works up to the point where you see something unexpected. One immediate change that I would make is to remove import arcgisscripting. It will not make any difference but is superseded by import arcpy so it is just one extra unnecessary line of code. – PolyGeo Aug 28 '14 at 23:39
  • This is a Q&A that may help with some ideas on how to get the crux of what you need to do into a code snippet that, once working, can be used to add back the former code one in small chunks at a time. – PolyGeo Aug 28 '14 at 23:45
  • Thanks, I'm starting to look at that. I just modified my code to just hte part that adds the symbology, but I had a few questions about the link you posted...is the code in the example you gave such that "Population" is the layer having symbology applied to it, and "Sub_Region" is the field the symbology is being applied to? – Alex Aug 29 '14 at 13:58
  • I am not sure if you have managed to resolve your issue, if not, the issue most probably is caused by your "join" before "apply symbology", since a join temporarily changes field names, i.e., <target data source name>.<field1>, <target data source name>.<field2>,... <joined data source name>.field1,<joined data source name>.field2, etc. Could you confirm that the symbology field of your layer file uses "the right field name"? – fatih_dur Feb 24 '15 at 23:26