Select to view content in your preferred language

Print Legend Question

5466
9
06-27-2014 09:02 AM
TimHayes
Frequent Contributor
I have created a custom print geoprocessing service. All works good.

However, the legend does not seem to resize when I try and print the map. It seems to overlap the map frame.

I have the Print Widget set up to export the map to a PDF.

I have attached a screenshot of what I am talking about.

I want the legend to not overlap the map frame and stay in the white space under the map frame.
Tags (2)
0 Kudos
9 Replies
BrianOevermann
Frequent Contributor
I've had hit and miss luck with legends in my print templates.  It seems to work better if you have a core set of layers that you are making available to your users.  That said...

You might try creating a legend "window" in your layout that spans the entire white space that you appear to have available for your legend.  You also should set, in the legend properties, more than just a single column for the legend.  The legend properties, by default, is a single column.  You will want to experiment with the number of columns.  I found that it worked better when I put in way more columns than I thought were feasible for the space I allocated to the legend (i.e. I thought no more than 5 or 6 columns would fit but I set it to 10 columns (just an example)).  Designating the number of columns seemed to work better when I was initially setting up the legend, and less so when I attempted to tweak the legend options later.

The other big tip--and you didn't mention this so you may already have this covered--is to leverage all of the legend options available to maximize the ability of the system to generate a readable legend that fits on the map.  You should go into the Items tab in the properties and check the box for each available layer to only show the features that are in the current extent.  This will eliminate any legend patches of features that don't exist in the current view.  This is a big help with, for example, a zoning map that is zoomed in to only show a small area where only a few different zones are present.  You don't need the legend to show every zone within the City/County in that context.

You should also play around with the word wrapping functionality.  You can set a maximum length for a legend entry and have it wrap to a new line.  For example, if you have a feature that is titled "Sites within project area greater than 5 acres" the word wrapping function will split that title into 2 or more lines.  Along with your column setup, this can maximize the layout of the legend.

There are a few other options in the legend properties that you can tweak to get the most out of your legend.  These tips really are useful for all of your maps.  If you have set up your templates in a folder that is registered on the server instead of having your layouts copied to the server, maintenance of your templates is really easy (as well as adding additional templates later).  I suggest creating a test layout template, and within the flex viewer add a bunch of layers to your map (many more than logical) and see what the print result is.  From there expand columns, etc. until it starts looking like you want it.  With the dynamic nature of the templates you really need to play a bit to see where it might break, unless you really constrain your users with the data available.
TimHayes
Frequent Contributor

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!

0 Kudos
BrianOevermann
Frequent Contributor

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

0 Kudos
TimHayes
Frequent Contributor
I decided to do away with the legend all together. It is just too much of a pain to get it to work properly. I have tried all of your suggestions and more. I even set up a Geodatabase with dummy layers. The legend is always either too big or covers up the map layout.

Also, the point symbols when exporting to a PDF look funky.

It is better to just not have a legend at all. I hope ESRI has a fix for this in their upcoming HTML5 and JavaScript viewers. I can wait until then.

My users are happy, what else matters? 🙂
0 Kudos
KevinMacLeod1
Frequent Contributor

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?

0 Kudos
ChrisBlinn1
Regular Contributor

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?

0 Kudos
BrianOevermann
Frequent Contributor

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.

0 Kudos
ChrisBlinn1
Regular Contributor

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.

0 Kudos
BrianOevermann
Frequent Contributor

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.