_(first, my apologies if doing it wrong, as this is my first ever github issue, but I have been encouraged by FPAF himself :-)_
In Leaflet there is a way to show multiple basemaps to chose from (as radio buttons) using the code below. I cannot get this to work with folium.LayerControl().add_to(map) because it only takes one parameter (map)
javascript Code:
var landMap = L.tileLayer.grayscale('http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png', {attribution: 'Map data', maxZoom: 18, minZoom: 8});
var osmMap = L.tileLayer.grayscale('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
{attribution: 'Map data', maxZoom: 18, minZoom: 8});
var baseMaps = { "Landscape Map": landMap, "OpenStreetMap": osmMap};
L.control.layers(baseMaps, overlayMaps, {collapsed:false}).addTo(map);
Sorry, the answer in folium is much simpler than I thought and I spotted it here:
http://deparkes.co.uk/2016/06/10/folium-map-tiles/
It is simply a matter of first defining the map e.g. my_map
then switching on the layer control with
folium.LayerControl().add_to(my_map)
then adding any number of out-of-the-box folium tiles e.g.
folium.TileLayer('openstreetmap').add_to(my_map)
folium.TileLayer('Mapbox Control Room').add_to(my_map)
They will all appear as radio-buttons, with a single one available to be displayed in any given time.
Please close this issue and thanks.
@Seraf69 I got below error when tried!
folium.TileLayer('openstreetmap').add_to(m)
AttributeError: 'module' object has no attribute 'TileLayer'
I believe you need to add the LayerControl after you added TileLayers.
Most helpful comment
Sorry, the answer in folium is much simpler than I thought and I spotted it here:
http://deparkes.co.uk/2016/06/10/folium-map-tiles/It is simply a matter of first defining the map e.g. my_map
then switching on the layer control with
folium.LayerControl().add_to(my_map)
then adding any number of out-of-the-box folium tiles e.g.
They will all appear as radio-buttons, with a single one available to be displayed in any given time.
Please close this issue and thanks.