1

So the ApplySymbologyFromLayer_management() tool doesn't seem to like me, at least when I try to use it in a script. I have a Field_Boundary2.lyr file that has a "hollow" fill color and a black outline for a polygon boundary. In ArcMap, when I import this layer's symbology onto another layer, it looks like this:

hollow field boundary

But if I try to use it with arcpy.ApplySymbologyFromLayer() in a script, it gives me this:

non-hollow field boundary

Here's the code:

        df = arcpy.mapping.ListDataFrames(mxd,"dfElevation")[0]
        fc1 = arcpy.mapping.Layer(fcGrid)
        arcpy.ApplySymbologyFromLayer_management(fc1, arcpy.mapping.Layer(symbologyTemplatePath + "Elevation.lyr"))
        arcpy.mapping.AddLayer(df,fc1,"BOTTOM")
        fc2 = arcpy.mapping.Layer(fcBound)
        arcpy.ApplySymbologyFromLayer_management(fc1, arcpy.mapping.Layer(symbologyTemplatePath + "Field_Boundary2.lyr"))
        arcpy.mapping.AddLayer(df,fc2,"TOP")

From the picture above you can see that the "Elevation.lyr" symbology is being imported correctly, but not the "Field_Boundary2.lyr". Any idea why this might be happening?

4
  • Don't forget to save the map file: mxd.save() Jan 21, 2015 at 22:47
  • Actually, it looks like your variable fc1 should be fc2 in line 6? Jan 21, 2015 at 22:52
  • @EmilBrundage That's it! Thanks for catching that for me!
    – GISUser9
    Jan 21, 2015 at 23:29
  • Cool, posted it as an answer. Jan 21, 2015 at 23:30

1 Answer 1

1

In line 6, change fc1 to fc2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.