Select to view content in your preferred language

Control which basemap shows on pdf using printTask

2460
11
06-05-2014 10:39 AM
AndrewMosley
Emerging Contributor
Hi there,

I have a printTask that works wonderfully except for one
unfortunate bit that I cannot seem to figure out or find any resources on.

I have two ArcGISTiledMapServiceLayers that function as basemaps; one of which is imagery on our arcgisonline server,
the other is ESRIs world Street Map.
The world street map displays until the user is zoomed in beyond a certain extent, then the imagery displays beyond that.

However, when executing printTask, the imagery always appears on top of the world street map, regardless of what is
currently being displayed.
Basically, I just want the printTask to print whatever basemap is currently displaying.

Any suggestions/thoughts/ideas would be most helpful. I've attached a screenshot of what's being output.

Thanks!
0 Kudos
11 Replies
JeffPace
MVP Alum
oh thats not good


  tiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Worl        d_Street_Map/MapServer");
       hcBasemap = new esri.layers.ArcGISTiledMapServiceLayer("http://www.blahblahblah.org/ArcGIS10/rest/services/Cache/Cache        Aerials2010/MapServer", {
             visible : false
    });
      hcBasemapDynamic = new esri.layers.ArcGISDynamicMapServiceLayer("http://www.blahblahblah.org/ArcGIS10/rest/services/Ca      che/CacheAerials2010/MapServer", {
             id : "Imagery_Dynamic",
             minScale : 564.248588125
    });


see how you have an id on your dynamic layer? you need to add one to your tiled layer
0 Kudos
AndrewMosley
Emerging Contributor
Ok so I've added the ID and now nothing loads.
Also it seems that merely hiding the layer is not removing it from the printTask's list of stuff to print,
only removing it has removed it from the print output.
Is it possible to reorder the layers using map.on?

If so I could just leave everything as is and add an if, else to swap their display order and achieve the desired printing...theoretically.

Also, if it helps the general structure is this:
function init() {
var initialExtent =...
var lods = ...
tiledBasemap = ...
dynamicBasemap = ...
map.addLayers ...
}

function swapBasemap(...){}

function resizeTheMap(map) {...}
function printMap(...){
printTask.execute}
0 Kudos