I use Map.setBasemap function to change the basemap. The basemap is changed, but it changes back to the default if I pan and zoom out the map. Is there a way to solve it, instead of use basemap gallery?
Thanks in advance,
li
Solved! Go to Solution.
Thanks for your quick response.
There is not much code at all.
I declare a function and use a menu item to pass basemap name. That's it.
It seems to me that the default map object doesn't get swopped.
var selectBasemap = function(basemapId) {
if (cwiMap.map.getBasemap() != basemapId) {
cwiMap.map.setBasemap(basemapId);
}
};
Regards,
li
Can you show us your code? It is hard to trouble shoot without seeing any code.
Thanks for your quick response.
There is not much code at all.
I declare a function and use a menu item to pass basemap name. That's it.
It seems to me that the default map object doesn't get swopped.
var selectBasemap = function(basemapId) {
if (cwiMap.map.getBasemap() != basemapId) {
cwiMap.map.setBasemap(basemapId);
}
};
Regards,
li
My bad. I reset the default according to the current extent and forgot it.