Printing Template - Dynamic Legend

3915
4
06-13-2013 10:40 AM
by Anonymous User
Not applicable
Original User: gabrielnespoli

Hi everyone,

I am not quite sure if this is the right sub-forum. Sorry if it is not.


Lets go to the point..I know how to define a dynamic legend to a map, there isn't problem with this and it works fine:

[ATTACH=CONFIG]25241[/ATTACH]

But, the problem happens when I try to publish a printing template. In templates, there isn't layer in the .mxd, so when I try to check "Only show classes that are visible in current map extent, this checkbox isn't editable, because in templates the map doesn't have any layer:

[ATTACH=CONFIG]25247[/ATTACH]

The result of not setting the legend dynamically is this:

[ATTACH=CONFIG]25249[/ATTACH]

As you can see, the legends of all layers are displayed, even the ones that are not in the map extent.


So, if anyone knows how can I set dynamic legend to printing templates, help me please!
0 Kudos
4 Replies
by Anonymous User
Not applicable
Original User: gabrielnespoli

Help me, please!
0 Kudos
StefanoMauri
New Contributor II
Hi Gabriel,
the problem is that the proprerty "visible in current extent" is a layer proprerty, not a legend proprerty. So, in yuor geoprocessing model, after you load layer in MXD document and before export map as PDF, you have to loop throught every item in legend and set property "use_visible_extent" to TRUE, with a code like this:
for lyr in legend.listLegendItemLayers():
     legend.updateItem(lyr, use_visible_extent = True)


Stefano
0 Kudos
by Anonymous User
Not applicable
Original User: fandre12345

Stefano,

Thanks for your answer, but i need to do this in Esri Toolbox:

[ATTACH=CONFIG]26929[/ATTACH]

If it were our toolbox could do as he said. Any other suggestion?
0 Kudos
ChristophSinn
New Contributor
I have the same problem,  who can help me?
0 Kudos