Hey Marion,
Not at all, I don't think it's super obvious and I have documented the functionality well yet. In terms of the demo console here is the code that I use:
var provider = getActiveProvider();
if (provider) {
var centerPos = map.getCenterPosition();
map.provider(provider);
map.gotoPosition(centerPos, map.getZoomLevel());
}
This can be found in
http://www.tile5.org/media/console/js/console.js (around line 277). Essentially, it is just a matter of calling the function 'provider' on the map passing in the new provider. Even if you have been looking through the Tile5 source, you are unlikely to be able to find this function as it is dynamically created when using COG.configurable (see
https://github.com/sidelab/cog/blob/master/src/configurable.js if you are interested). I wrote a blog post on configurable back when I first built it into the COG library (which is used under Tile5). If you are interested check it out here:
Anyway, once you have updated the provider all that is left to do is to tell the map to update it's position (as this triggers) the tile retrieval from the provider and without the call nothing happens. In my situation I just ask it the map to go to the exact same position that it is already at with the same zoom level. Markers, layers and state are all maintained.
Hope this helps :)
Cheers,
Damon.