Thanks Brian. I finally found the time to fiddle around with all this legend stuff. Your advice was very helpful. I also would like to mention that in order to get the legend to work I needed to add a "Dummy Layer"; an empty Feature Class that is turned off in the ArcMap TOC. Having this Dummy Layer (should always be turned off) activates a lot of Legend Properties that are grayed out when there are no Layers in the TOC.
Note to everyone: I spent 4 hours fiddling around with this, Export Web Map then overwriting my Geoprocessing Service was the easy part. The most time consuming part was trying to configure the Layout Template Legend to display properly. It was a process of "Rinse and Repeat" over and over and over again, try this then that etc.... patience is a must!
I hope the new Web Map that is in beta 2 will make it easier to set up and configure the legend!
Tim,
Interesting comment regarding the "dummy layer". It turns out that I have our city limit boundary added to the map, but turned off, so I never came across the issue. I remember intentionally adding the layer so that ArcMap would have our projection "locked in" to the map document to prevent any re-projection-on-the-fly issues.
"Rinse and Repeat" sums the process up beautifully! Glad you found some/all of my advice helpful.
Brian
Our layers are turned off in the MXD and users turn them on in the AGS TOC. So, so far no layers are appearing in the Legend. I will have to figure that out. Thank you all for the useful info here though! Especially the tip about only showing smyobls in the map extent.
But I have another question. We have a parcel layer. If a user selects a parcel with our Parcel search tool, I want to display the attribute info for the parcel in a corner of the printout from the Print dijit. Or if we need to use PrintTask I guess we can do that. Does anyone have a sample or a link to a site that does this? Displays attribute data in the print output?
I want to bump this post because I am having similar issues getting the legend to behave correctly.
We've put together a simple map maker application for others to quickly go online, select the layers they want to display, and print.
The template was setup with all of the layers from the map maker application in the TOC, turned on, so we could theoretically see the maximum size the legend could be. Once we had the columns, style, and size figured out, the layers were turned off and we had our template. However when you print, the legend does not respect the settings from the template. As items are added, the top of the legend moves up, rather than the bottom moving down. So we switched the position of the legend to the bottom of the page so as items are added, it will move up. This worked until we had too many items and no new columns were being created (even though we setup the legend to have 3 columns).
What are we missing here?
Christopher,
Is there a particular reason you are developing a new Flex app at this point in time? Flex (Flash) and Silverlight are "dead men walking" and Esri is no longer enhancing the Flex API. Esri has move on to the WebAppBuilder and HTML5. Some popular browsers are even phasing out support for Flash.
While we still have a Flex app or two hanging around, we've shifted to using Latitude Geographic's Geocortex framework for creating our HTML5 viewers. It allows us to consume our map services directly without creating a web map first (a requirement for using WebAppBuilder).
Not an employee of the company, just a person happy that there's a company that recognizes the cloud isn't the answer for everything.
I didn't want to ignore your bumped message and my asking for a reason is more rhetorical than an actual need to know. Even the OP came to the conclusion, as did I, that implementing effective dynamic legends was difficult--if not impossible--in the Flex "world". To be honest, I think legends in web apps only make sense when you have a very defined set of layers (and a small number of them as well) that are not dynamically changeable by the end user.
Sorry - I didn't realize this was in the Flex forum. I simply clicked on a search result and blindly added the comment. This is NOT a Flex app, but rather a core WAB application made in AGO. This forum was detailing issues VERY similar to what I am seeing with my custom print template, which is why I added a comment and didn't just publish a new thread.
I can move it to the appropriate thread.
No worries, Christopher. I just didn't want you to start a dead end project! I think my comments regarding legends stand regardless of the platform.
FWIW, the Geocortex framework handles the creation of print templates totally differently. Legend creation is slightly better, BUT you can't leverage the built-in ArcGIS options like only showing features/symbol classes within the current extent. You build the template within their report designer which, like any tool, has some advantages and disadvantages. I'd like to at least have the option to use the templates I created for the Flex app directly since I already had them and put effort into creating them. It's a current idea but I'm unsure if it will be implemented. But the issue of allocating enough space for a dynamic legend still exists. So there is no silver bullet.