DynamicLayerRenderer not showing up in legend of Print Task output

979
5
11-27-2012 01:01 PM
MichaelParry
New Contributor II
Hello,

I'm having trouble understanding how to get the dynimically rendered layer to show its symbology in the legend when using an "Export Web Map" Print Task. The "Web_Map_As_Json" shows that the layers/layerDefinition/drawinInfo seems to be filled out properly (I believe):

{
   "mapOptions":{
      "extent":{
         "xmin":-16070985.376094976,
         "ymin":2340082.217928768,
         "xmax":-4525936.623905024,
         "ymax":10998868.782071233,
         "spatialReference":{
            "wkid":102100
         }
      },
      "spatialReference":{
         "wkid":102100
      }
   },
   "operationalLayers":[
      {
         "id":"layer0",
         "url":"http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer",
         "title":"layer0",
         "opacity":1
      },
      {
         "id":"DynamicLayerRenderer",
         "url":"http://xxxxxxx/xxxxxx/arcgis/rest/services//xxxx/2011Census_CCS/MapServer",
         "title":"DynamicLayerRenderer",
         "opacity":0.7,
         "visibleLayers":[
            6
         ],
         "layers":[
            {
               "id":6,
               "layerDefinition":{
                  "id":6,
                  "source":{
                     "type":"mapLayer",
                     "mapLayerId":6
                  },
                  "drawingInfo":{
                     "renderer":{
                        "type":"classBreaks",
                        "field":"BEE_OT_GALLON_NUM",
                        "minValue":-999,
                        "classBreakInfos":[
                           {
                              "classMaxValue":-999,
                              "label":"-999",
                              "description":"",
                              "symbol":{
                                 "color":[
                                    255,
                                    255,
                                    153,
                                    255
                                 ],
                                 "type":"esriSFS",
                                 "style":"esriSFSSolid"
                              }
                           },
                           {
                              "classMaxValue":1490,
                              "label":"-998 - 1490",
                              "description":"",
                              "symbol":{
                                 "color":[
                                    175,
                                    255,
                                    122,
                                    255
                                 ],
                                 "type":"esriSFS",
                                 "style":"esriSFSSolid"
                              }
                           },
                           {
                              "classMaxValue":4790,
                              "label":"1491 - 4790",
                              "description":"",
                              "symbol":{
                                 "color":[
                                    92,
                                    255,
                                    124,
                                    255
                                 ],
                                 "type":"esriSFS",
                                 "style":"esriSFSSolid"
                              }
                           },
                           {
                              "classMaxValue":8751,
                              "label":"4791 - 8751",
                              "description":"",
                              "symbol":{
                                 "color":[
                                    61,
                                    255,
                                    216,
                                    255
                                 ],
                                 "type":"esriSFS",
                                 "style":"esriSFSSolid"
                              }
                           },
                           {
                              "classMaxValue":17000,
                              "label":"8752 - 17000",
                              "description":"",
                              "symbol":{
                                 "color":[
                                    31,
                                    165,
                                    255,
                                    255
                                 ],
                                 "type":"esriSFS",
                                 "style":"esriSFSSolid"
                              }
                           },
                           {
                              "classMaxValue":103946,
                              "label":"17001 - 103946",
                              "description":"",
                              "symbol":{
                                 "color":[
                                    0,
                                    0,
                                    255,
                                    255
                                 ],
                                 "type":"esriSFS",
                                 "style":"esriSFSSolid"
                              }
                           }
                        ]
                     }
                  }
               }
            }
         ]
      },
      {
         "id":"layer1",
         "url":"http://xxxxxxx/xxxxxxx/arcgis/rest/services//xxxxxx/Reference/MapServer",
         "title":"layer1",
         "opacity":1,
         "visibleLayers":[
            0
         ],
         "layers":[

         ]
      },
      {
         "id":"layer2",
         "url":"http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer",
         "title":"layer2",
         "opacity":1
      }
   ],
   "exportOptions":{
      "outputSize":[
         1180,
         885
      ],
      "dpi":96
   },
   "layoutOptions":{
      "titleText":"<enter title>",
      "authorText":"http://xxxxxxxxx/debug.html",
      "scaleBarOptions":{

      },
      "legendOptions":{
         "operationalLayers":[
            {
               "id":"DynamicLayerRenderer",
               "subLayerIds":[
                  6
               ]
            },
            {
               "id":"layer1",
               "subLayerIds":[
                  0
               ]
            }
         ]
      }
   }
}


However, after the Print Task has produced the ouput (a pdf using a custom layout), the map is rendered fine, the legend does contain the correct operational layers, but renders the default symbology of the dynamic service layer (which is just a simple hollow fill). The Service layer does support dynamic layers.

Does the WebMapJson adequately describe the legend in the legendOptions given the description for the "layers"?

The ExportWebMap Specification doesn't really allow for anything other than strings or numbers for subLayerIds depending on the type of service you're trying to display.

I think I'm missing something basic but can't seem to see it...

Any help or comments would be appreciated,

Michael
0 Kudos
5 Replies
Yi_LikTsang
New Contributor
Hi Michael,

I am having the same problem.  Did you manage to find a solution?

Regards,

Yi-Lik
0 Kudos
MichaelParry
New Contributor II
Sorry for the late reply,

I have an issue with ESRI support about this but they needed me to supply them with some sample code to demonstrate this as they can't reproduce the problem. If you have some sample code that shows this problem that hopefully is simple and based on the JSAPI, could you let me know? It will take me a while to extricate the relevant code from our codebase as we've built a large framework based on the JSAPI.

If you do, then maybe we could re-activate the ticket and get them to address this.

Thanks,
Michael
0 Kudos
Yi_LikTsang
New Contributor
From ESRI Support:
ESRI in the States have advised that the subject issue is a bug, with ID number NIM085644:
NIM085644 - Legend swatch in output of PrintTask reverts to original service symbology when setLayerDrawingOptions is used on a DynamicMapService.


I have tested this in version 3.5, and it is still not working.
0 Kudos
SoniaScialanca
New Contributor
Hi, I have the same problem, I think it's because of the different responses from the service: if the legend is directly from the legend layer, the rest call returns some info in the json object (eg. the image path for every class break), but when the legend is from a dynamic request the infos into the json object are a little different.
I looked for the bug id on the online bug website, but I can't find it.
I hope to read some news about it in this thread...
0 Kudos
SoniaScialanca
New Contributor
Hello, someone has finally found the solution?
0 Kudos