AnsweredAssumed Answered

Can you remove the basemap using BasemapGallery?

Question asked by bensayers on Sep 30, 2010
Latest reply on Sep 22, 2015 by bdaigle
Hello,
I am trying compile my own basemap gallery, I have it all working, except I would like to provide users with the option to turn off all underlying Tiled Map layers as sometimes the imagery gets in the way of the features.
This is what I have:
function createBasemapGallery(){
       var basemaps= [];
        var imageryLayer = new esri.dijit.BasemapLayer({
          url:"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
        });
        var imageryBasemap = new esri.dijit.Basemap({
          layers:[imageryLayer],
          title:"Imagery",
          thumbnailUrl:"images/imageryThumb.jpg"
        });
        basemaps.push(imageryBasemap);

  var boundariesLayer = new esri.dijit.BasemapLayer({
          url:"http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer"
        });
        var imageryBoundariesBasemap = new esri.dijit.Basemap({
          layers:[boundariesLayer,imageryLayer],
          title:"Imagery (labels)",
          thumbnailUrl:"images/imagery_labelsThumb.jpg"
        });
        basemaps.push(imageryBoundariesBasemap);
  
  var topographicLayer = new esri.dijit.BasemapLayer({
          url:"http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
        });
        var topographicBasemap = new esri.dijit.Basemap({
          layers:[topographicLayer],
          title:"Topographic",
          thumbnailUrl:"images/topographicThumb.jpg"
        });
        basemaps.push(topographicBasemap);
  
  var streetLayer = new esri.dijit.BasemapLayer({
          url:"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
        });
        var streetBasemap = new esri.dijit.Basemap({
          layers:[streetLayer],
          title:"Street Map",
          thumbnailUrl:"images/streetThumb.jpg"
        });
        basemaps.push(streetBasemap);  
  
  var terrainLayer = new esri.dijit.BasemapLayer({
          url:"http://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer"
        });
        var terrainBasemap = new esri.dijit.Basemap({
          layers:[terrainLayer],
          title:"Terrain Map",
          thumbnailUrl:"images/terrainThumb.jpg"
        });
        basemaps.push(terrainBasemap);   
  
  var noneLayer = new esri.dijit.BasemapLayer({
          url:"http://"
        });
        var noneBasemap = new esri.dijit.Basemap({
          layers:[noneLayer],
          title:"None",
          thumbnailUrl:"images/noneThumb.jpg"
        });
        basemaps.push(noneBasemap);  
  
        var basemapGallery = new esri.dijit.BasemapGallery({
         showArcGISBasemaps:false,
         basemaps:basemaps,
         map:map
        },"basemapGallery");
        basemapGallery.startup();
        dojo.connect(basemapGallery, "onError", function(error) {console.log(error)});
      }


When I click on None the map doesn't change and whichever was the previous selected basemap stays active.

Any ideas?

Outcomes