AnsweredAssumed Answered

esri.tasks.LegendLayer() and PrintLayout

Question asked by g3r4n on Aug 12, 2014

I would like to create the legend of a printTemplate, dynamically with JavaScript API, but the legend on the printLayout are not what i expect when i print the map. I think maybe my legend component on the printLayout created in ArcMap is wrong. any tips to help me ? thx in advance !

 

JSON of the print request :

 

{

  "mapOptions" : {

  "showAttribution" : true,

  "extent" : {

  "xmin" : 233422.95398225903,

  "ymin" : 6233152.500865271,

  "xmax" : 286928.8737818103,

  "ymax" : 6269039.685645113,

  "spatialReference" : {

  "wkid" : 102100

  }

  },

  "spatialReference" : {

  "wkid" : 102100

  },

  "scale" : 144447.63857199997

  },

  "operationalLayers" : [{

  "id" : "defaultBasemap",

  "title" : "defaultBasemap",

  "opacity" : 1,

  "minScale" : 591657527.591555,

  "maxScale" : 1128.497176,

  "url" : "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"

  }, {

  "id" : "WEB_CARTE_OLD_6001",

  "title" : "WEB_CARTE_OLD_6001",

  "opacity" : 1,

  "minScale" : 0,

  "maxScale" : 0,

  "url" : "https://<service-url>/arcgis/rest/services/MapServices/WEB_CARTE_OLD/MapServer",

  "visibleLayers" : [6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 22, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 48, 49, 66, 67, 68, 69, 70, 75],

  "layers" : []

  }, {

  "id" : "MAP_AND_WORKSPACE_8443",

  "title" : "MAP_AND_WORKSPACE_8443",

  "opacity" : 1,

  "minScale" : 0,

  "maxScale" : 0,

  "url" : "https://<service-url>/arcgis/rest/services/MapServices/MAP_AND_WORKSPACE/MapServer",

  "visibleLayers" : [0],

  "layers" : []

  }, {

  "id" : "graphicsLayer0",

  "opacity" : 1,

  "minScale" : 0,

  "maxScale" : 0,

  "featureCollection" : {

  "layers" : []

  }

  }, {

  "id" : "graphicsLayer1",

  "opacity" : 1,

  "minScale" : 0,

  "maxScale" : 0,

  "featureCollection" : {

  "layers" : []

  }

  }, {

  "id" : "map_graphics",

  "opacity" : 1,

  "minScale" : 0,

  "maxScale" : 0,

  "featureCollection" : {

  "layers" : []

  }

  }],

  "exportOptions" : {

  "outputSize" : [1400, 939],

  "dpi" : "96"

  },

  "layoutOptions" : {

  "customTextElements" : [{

  "texteTitre" : "test titre"

  }],

  "scaleBarOptions" : {},

  "legendOptions" : {

  "operationalLayers" : [{

  "id" : "WEB_CARTE_OLD_6001",

  "subLayerIds" : [6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 22, 49, 56, 62, 63, 64, 70, 75]

  }, {

  "id" : "MAP_AND_WORKSPACE_8443",

  "subLayerIds" : [0]

  }]

  }

  }

}

Outcomes