Allow displaying ONLY symbology in map extent for Print task Legend in JavaScript API viewer

12-16-2014 10:46 AM
Status: Open
Occasional Contributor III

When a map layer has multiple classes or symbology symbols, such as a soil layer, it does not appear on the Legend in a print result from the Print dijit in the Javascript web API web map viewer.

For example, a soil layer may have 30 different soil types.  However, usually a user will zoom to a block or a neighborhood, with only one or a few different soil types present on the map.  Currently, soil is not displayed at all in the Legend in the Javascript viewer.

However, in the Legend options on the MXD in ArcMap 10.2.2 I noticed there is a checkbox that at first I thought would solve this problem. .... First, right click on the Legend, in the MXD, go to Properties... and the Items tab, then select the specific layer (i.e. Soil).  The top checkbox states "Only show classes that are visible in the current map extent."  It does exactly what we would want, in the map MXD.  So for saving a map in ArcMap to a PDF or to print, this works great.  But what if we want this service to be accessed through a javascript api web map?  The Soil legend simply doesn't show up, because it has 30 different symbols.  I thought I could click this checkbox in the Legend in the Print Template MXD, but no, you can't. It's greyed out.

I called ESRI Tech Support and they said that indeed, it is not supported. But that it is a good idea to implement and to submit to ArcGIS Ideas.

Does anyone else think this is useful?  And understand what I am requesting?  I have a submitted a duplicate post here I apologize but I looked briefly and didnt' see anything like it.

Thank you,



I just came across this need today on a AGOL map that I'm making.  

Also, there appears to be several other similar posts on ArcGIS Ideas that maybe should be consolidated/moved to this one (and their vote score added together)

Portal/Online - Print Templates: add option to place legend on separate page or extent based legend ... 

Embedded Webmap legend to display only features in current extent 

layerlist symbology only if visible in extent 


Would also be nice to more easily create more templates. And have Print task work for multiple pages. To print content on a second page or more. This would also allow printing of a "legend" page or pages(s).  (Put the legend element in that print template MXD and then hit that via the print task; but first, print Widget in WAB or API must support this)  Thus, we could create a template containing the legend that can fill up a whole page and run on to multiple pages to show just the symbology symbols.  We used to have a static mxd we'd print and attach to paper maps for all our armory symbols at the National Guard. Because yes, with utilities, government, or other large enterprises, you're going to have a lot of symbols! Or with data like SSURGO, NWI et al.  I have not gotten around to doing this yet in python but if it is simple, I put forth that it be integrated into the API or Server as a standard workflow option.

Its been 5 years since this was first posted... how has this not been fixed yet?

This still don't was fixed? I'm using version 3.34.

This is not a function of the API, but the Web Map Print Service from your server.  The print templates need to be set up to filter the symbology for the visible area.  This works with print services published from ArcGIS Pro and with the default Utilities Print Services from 10.7 and up.  This is obviously for vector layers only and not raster layers.

In ArcMap I created the field to legend and I marked the field "Only show classes that are visible in the current map extent", when I view my map by ArcMap it is wirking well but when I try to access my map by API, its return together all legends.

Can you help with this?