Combinig two map serices

450
1
01-28-2014 12:43 AM
vinayb
by
New Contributor III
HI all,

  I want to combine two map serices , i have one map service which is map and other has some other service . I need to combine these and show on .I tried the following

map = new Map("MapSection", { 
          extent: initExtent
        });
  
          WorldCountries1 = new esri.layers.ArcGISDynamicMapServiceLayer("mpasericeurl1");
 map.addLayer(WorldCountries1);                                    
  var WorldCountries = new ArcGISDynamicMapServiceLayer("arcgisUrl");
        //WorldCountries.setOpacity(0.75);
        console.log(" in map ");
        map.addLayer(WorldCountries);


  When i did that the first service is displaying behind the second service , i reversed the order in which i am adding layer but still issue persist what could be the better way to do this.
0 Kudos
1 Reply
KenBuja
MVP Esteemed Contributor
If I am understanding your question correctly, you are trying to add the services in a particular order. Instead of using addLayer after declaring each layer variable, you can use addLayers to add them in any order you want.

var WorldCountries1 = new esri.layers.ArcGISDynamicMapServiceLayer("mpasericeurl1");
//map.addLayer(WorldCountries1);                                    
var WorldCountries = new ArcGISDynamicMapServiceLayer("arcgisUrl");
//WorldCountries.setOpacity(0.75);
console.log(" in map ");
//map.addLayer(WorldCountries);

map.addLayers([WorldCountries, WorldCountries1]);

//or map.addLayers([WorldCountries1, WorldCountries]);
0 Kudos