OverviewMap dijit baseLayer

3101
1
10-05-2011 06:37 AM
PetarMaletić
New Contributor
Hi,

Is there a way to change baseLayer for OverviewMap dijit. I have multiple basemap layers that are shown or hidden when user select one from my custom basemap gallery...

Thanks.
0 Kudos
1 Reply
KellyHutchins
Esri Frequent Contributor
We handle this in the basic viewer template by doing the following:
1. When a new basemap is selected from the basemap gallery destroy the overview map:

dojo.connect(basemapGallery, "onSelectionChange", function () {
     //close the basemap window when an item is selected
     //destroy and recreate the overview map  - so the basemap layer is modified.
     destroyOverview();
     dijit.byId('basemapBtn').closeDropDown();
   });

2. The destroy overview map function destroys the existing overview map and recreates so its using the new basemap layer:
 function destroyOverview(){
  var ov  = dijit.byId('overviewMap');
  if(ov){
    var vis = ov.visible;
    ov.destroy();
    addOverview(vis);
  }
 }


Here's the code that creates the overview map
function addOverview(isVisible) {
   var overviewMapDijit = new esri.dijit.OverviewMap({
     map: map,
     attachTo: "top-right",
     opacity: 0.5,
     color: "#000000",
     expandfactor: 2,
     maximizeButton: false,
     visible: isVisible,
     id:'overviewMap'
   });
   overviewMapDijit.startup();
 }

Basic Viewer Template Test
http://apps.arcgis.com/hosted/OnePane/basicviewer/index.html?appid=51cd7d314e3d4e57a1e28b1b5698abd0&...