AnsweredAssumed Answered

change basemap with a url

Question asked by rajni_sharma on May 14, 2020
Latest reply on May 17, 2020 by rajni_sharma

how to change basemap for a url. I want this layer to become my basemap layer on button click.

like for topo button i want this layer to come as basemap. LINZ/geotiffs (MapServer) 

 

How to change my code accordingly. Thanks in advance 

 


var topoBtn =domConstruct.toDom("<div class='map-button esri-component esri-widget--button esri-widget topo mapbtncolor' role='button' title='topo'>TOPO<span aria-hidden='true' role='presentation'></span></div>") ;
var satelliteBtn = domConstruct.toDom("<div class='map-button esri-component esri-widget--button esri-widget sat basmapcolor' id='satt' role='button' title='sattelite'>SATELLITE<span aria-hidden='true' role='presentation'></span></div>") ;

function setbasemap(basemap){
webmap.basemap = basemap;
}
topoBtn.addEventListener('click', function(){
setbasemap('topo');
});
satelliteBtn.addEventListener('click', function(){
setbasemap('satellite');

});

Outcomes