I have the following code fragment in an esri page to try and change basemaps, the following code works, unless the next basemap layer uses a different spatialreference.
if (baseMap)
_map.removeLayer(baseMap);
baseMap = new esri.layers.ArcGISTiledMapServiceLayer(mapSource);
_map.addLayer(baseMap);
It seems like my only option is to destroy the map instance and start from scratch every time the user desires to change the basemap. Am I going about this the wrong way... anyone have any insight? I have seen samples of the basemapgallerywidget, but haven't used it.
So the basic question is: To change basemaps,not knowing the future basemap spatial reference, is my only option to destroy the map instance and re-create it?