Cartodb add basemap switcher

المشرف العام

Administrator
طاقم الإدارة
I currently have a map created entirely in the CartoDB editor, including custom map. For some reason it doesn't allow you to add an attribution in the editor but thats a different problem.

So my map has a custom baselayer and 3 toggleable layers. Here is the code.

I know that I could replace the current base map by adding

.done(function(vis, layers) { var basemap = layers[0]; basemap.setUrl('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); }) However im not sure if its possible to enable a base map switcher, or if I need to add it as a new layer completely will I need to do that via the code. Adding in a whole new set of tiles seems to be more of a basemap switch than just a data layer.



أكثر...
 
أعلى