AnsweredAssumed Answered

Automatically add layers to legend

Question asked by rmcculley on Mar 17, 2017
Latest reply on May 26, 2017 by rmcculley

I've got a ArcGIS Pro project file with a single map, and 28 layouts that reference the map.  All 28 layouts have a legend that also references the map.  I've created a python script that uses arcpy.mp to add layers to the map, and export all 28 layouts to pdf's.  Unfortunately, when the layers get added to the map, they are not added to the legends. I've also tried manually adding the layers to the map within ArcGIS Pro, and the layers are not added to the legends.

 

I've checked the Format Legend pane, and all of the Synchronize with map options are checked.

 

I'm looking for one of two solutions:

  1. Have the layers automatically added to all of the legends when I add them to the map
  2. Add the layers programatically to the legend using arcpy.mp before I export the layout to pdf.

Is there a way to add the layers to the legend using arcpy?  From browsing the documentation, the only way I've found to add layers to an existing legend is to drag and drop them from the Contents pane to the Legend item.  How do I replicate this in arcpy?

 

I'm using ArcGIS Pro version 1.4.1 on a project file that was created in ArcGIS Pro 1.4.1.

Outcomes