WebTiledLayer and PrintTask working at 10.2?

3172
3
Jump to solution
07-31-2014 12:48 PM
deleted-user-Jie3eyjOl9XM
Occasional Contributor

I've seen some others discuss, but no answers. I've got a WebTiledLayer, which is working great. But, when I print using the standard Print task, the layer isn't there. I can see it's being sent over in the JSON. But, I can also see that the JSON doesn't include the LOD's. And, those should be required by the Print Task. Had anyone had success?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
deleted-user-Jie3eyjOl9XM
Occasional Contributor

Yes, I've worked this out. It seems like it can't be done "out of the box". The ESRI print dijit, which creates the webMapAsJson, does not include the TileInfo your the WebTiledLayer. You'll have to capture the request before it goes to the print service, and insert the TileInfo.

Here's is roughly the way it works in my application widget:

_modifyRequestForWebTiled: function (ioArgs) {

   if (ioArgs && ioArgs.content && ioArgs.content.Web_Map_as_JSON) {

      var webmapJson = JSON.parse(ioArgs.content.Web_Map_as_JSON);

      if (webmapJson.operationalLayers.length) {

         arrayUtils.forEach(webmapJson.operationalLayers, function (lyr) {

             if (lyr.type == 'WebTiledLayer') {

               lyr.tileInfo = this.map.getLayer(lyr.id).tileInfo;

            }

         });

   }

}

esriRequest.setRequestPreCallback(lang.hitch(this, '_modifyRequestForWebTiled'));

I expected this to be fixed in the 3.11 API, but it looks like you'll still need this fix at 3.11. Not, you can still run into a lot of other issues while printing WebTiledLayers. One of those is opacity.

View solution in original post

3 Replies
MandeepChauhan
New Contributor

I am experiencing same and trying to find if WebTiledLayer is supported for printing or not. There are no errors and just getting blank prints. If map have any other type of layer in addition to WebTiled layer then other layers are getting printed fine but not WebTiledLayer.

0 Kudos
deleted-user-Jie3eyjOl9XM
Occasional Contributor

Yes, I've worked this out. It seems like it can't be done "out of the box". The ESRI print dijit, which creates the webMapAsJson, does not include the TileInfo your the WebTiledLayer. You'll have to capture the request before it goes to the print service, and insert the TileInfo.

Here's is roughly the way it works in my application widget:

_modifyRequestForWebTiled: function (ioArgs) {

   if (ioArgs && ioArgs.content && ioArgs.content.Web_Map_as_JSON) {

      var webmapJson = JSON.parse(ioArgs.content.Web_Map_as_JSON);

      if (webmapJson.operationalLayers.length) {

         arrayUtils.forEach(webmapJson.operationalLayers, function (lyr) {

             if (lyr.type == 'WebTiledLayer') {

               lyr.tileInfo = this.map.getLayer(lyr.id).tileInfo;

            }

         });

   }

}

esriRequest.setRequestPreCallback(lang.hitch(this, '_modifyRequestForWebTiled'));

I expected this to be fixed in the 3.11 API, but it looks like you'll still need this fix at 3.11. Not, you can still run into a lot of other issues while printing WebTiledLayers. One of those is opacity.

MandeepChauhan
New Contributor

Thanks for your reply. I have done the change you suggested to add tile info but still coming up as blank print. You mentioned opacity as well. Do you have similar tweek for that as well?

0 Kudos