I want to change the extent and operational layers of a map for several printTasks. The goal is to take a group of polygons, and create a map of each one separately, changing the basemap and some operational layers on each map. The resulting maps will end up in a report. What is the best approach to do this? A couple thoughts I had:

  1. Change the map object to the desired operational layers and extent before printing, then revert the map object back to the original state after printing. (seems like a lot of extra steps this way)

  2. Use a modified Web_Map_as_JSON parameter for each map. I could have this is a pre-configured string that would be easily modified. If this is a reasonable solution, is it possible to add Web_Map_as_JSON` as a parameter to the printtask like this:

        //pre-configured JSON map string
        var web_map_as_json = this.web_map_as_json
        //modify JSON here (extent of each polygon, etc..)
        var params = {
            Web_Map_as_JSON: web_map_as_json,
            Format: 'png32',
            Layout_Template: 'MAP_ONLY'
        printTask.execute(params, lang.hitch(this, 'onParcelPrintComplete'), lang.hitch(this, 'onParcelPrintError'));

1 Answer 1


This worked for my needs:

      var printMapDiv = domConstruct.create('div', {id: 'printMapDiv', style: 'display: none'});

      var printMap = new Map(printMapDiv, {
            //map params

      //execute print task

      //destroy the dom when you are done with the print

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.