Dynamic Layers / Export Web Map / Legend

4337
8
09-10-2012 03:30 PM
AlexJacobson
New Contributor
I have a javascript application where I am utilizing dynamicLayers to manipulate a demographic layer in order to dynamically generate a class breaks render based off of the current map extent. Everything works great. I even have a legend dijit that automatically updates the classes every time the exent is changed.

I setup an ExportWebMap geoprocessing task with a custom layout to display a legend on the output image. This geoprocess task also works great, producing a high-quality image of the dynically generated class breaks as well as a legend.

The problem is the legend is not displaying the dynamically generated classes. It appears to be displaying the default classes returned from myservice/MapServer/Legend.

I know that the legend endpoint supports dynmicLayers as I am using it elsewhere and otherwise my legend dijit would not work. Is it possible that the ExportWebMap geoprocessing task does not support dynamicLayers on a legend in the layout?

Any insight would be appreciated.

Thanks,
-Alex
Tags (2)
0 Kudos
8 Replies
TanuHoque
Esri Regular Contributor
Alex,
It seems like you are hitting a bug that is supposed to get fixed in 10.1 SP1. In general the legends of a dynamicLayer is supported by Print Service.
Could you please attach the JSON that your web app sends to the print service?

Thanks
0 Kudos
AlexJacobson
New Contributor
I've attached the webmap json.

Thanks,
-Alex
0 Kudos
TanuHoque
Esri Regular Contributor
Thanks Alex,
Since all layers in the JSON use your mapservice, unfortunately I could try the JSON out.
Can you please try with this mapservice to check whether you can still run into the same issue? if so, please send me the json.
http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer

Thanks
0 Kudos
AlexJacobson
New Contributor
I'm seeing the same results when pointing to the census layer provided: The output image is displaying the properly rendered classes, however the legend is displaying the default legend returned from the legend endpoint.

I've attached the modified webmap json as well as the output image.

Thanks,
-Alex
0 Kudos
TanuHoque
Esri Regular Contributor
Thanks Alex,

Found issues in the JSON:

  1. It is recommend that you should have a unique "id" assigned to each dynamic-layer. In your case, you are assigning the same "id" that is already assigned to an existing layer in the mapservice.

  2. I see the json contains another "id" property in layerDefinition. please get rid of that.


Finally to get it working for you in 10.1, you need to remove the sublayerIds array from legendOptions.operationalLayers. This is a bug that should get fixed with 10.1 SP1.

I have attached the correct JSON here as well.
0 Kudos
AlexJacobson
New Contributor
I tried your attached webmap json, but instead of producing a legend with correct classes an image with no legend was produced. I made 1 small modification to your json, adding the 'id' property back to the 'layerDefinition' object (the webmap json that get's posted by the esri print dijit does this as well), and received the same results as before: a legend with the default symbol.

Any other Ideas?

I've attached the new json.

Thanks,
-Alex
0 Kudos
TanuHoque
Esri Regular Contributor
Alex,

hmm... here is a classic response -- "it works for me" :).
Another thing that I tried was assigned "10" to the "id" inside the layerDefinition and that worked as well. Give that a shot.

It is very hard to debug something when the setups etc. is completely unknown.
Could you please contact our Tech Support? Someone should be able to help you out with this.

We will look into why the additional "id" is getting added by JS.
0 Kudos
ThomasPuthusserry
New Contributor III
I have a JavaScript application which consumes the manually created ExportWebMap geoprocessing task and calls the custom designed print templates.I am able to get the print out neatly, but legend section is empty. Any ideas, what is missing here?

I have used the same print task in a Flex Viewer, and can get the legends in the map print out.



Thanks

Thomas
0 Kudos