AnsweredAssumed Answered

Basemap Toggle not working on 3.11 with custom basemaps!

Question asked by Reda20 on Nov 6, 2014
Latest reply on Dec 2, 2014 by MDriscoll-esristaff

Hi everyone,

I am consuming an ArcGIS Dynamic Map service and 2 basemaps on which I want to apply a BasemapToggle.

 

Any idea why this code is not working?

 

//Toggle

  //console.log(esriConfig.defaults.map.basemaps);

  esriConfig.defaults.map.basemaps.BaseMapEnglish = {

  baseMapLayers: [

  { url: "http://geoportal.abudhabi.ae/rest/services/BaseMapEnglish/MapServer" }

    ],

  title: "BaseMapEnglish"

   };

 

  esriConfig.defaults.map.basemaps.BaseMapSatellite = {

  baseMapLayers: [

  { url: "http://geoportal.abudhabi.ae/rest/services/BaseMapSatellite1m/MapServer" }

    ],

  title: "BaseMapSatellite"

  };

  console.log(esriConfig.defaults.map.basemaps);

 

  var toggle = new BasemapToggle({

   map: map,

   basemap: "BaseMapSatellite",

   basemaps: {

  BaseMapEnglish: {

   label: "BaseMapEnglish",

   url: "http://www.delorme.com/images/homepage/dbm_icon.jpg"

  },

  BaseMapSatellite: {

   label: "BaseMapSatellite",

   url: "http://js.arcgis.com/3.7/js/esri/dijit/images/basemaps/topo.jpg"

  }

   }

  }, "BasemapToggle");

 

  toggle.startup();

 

  //Toggle

 

  var MDServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://10.10.1.108:6080/arcgis/rest/services/ZS_MapDoc/MapServer",

  {

  "id": 'ZS',

  "opacity": 0.6

     });

 

 

  var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://geoportal.abudhabi.ae/rest/services/BaseMapSatellite50cm/MapServer");

 

  map.addLayer(basemap);

  map.addLayer(MDServiceLayer);

 

Please help.

I basically referred to the following URL for my work but it doesn't seem to be working from my side.

Basemap Toggle | ArcGIS API for JavaScript

Outcomes