Multiple layers as background

I would like to create a map with 2 o3 3 possibilities for background. If I define the tiles inside a Group:

tiles=dl.LayerGroup([ dl.TileLayer(url=“{x}&y={y}&z={z}”),
dl.TileLayer() ])

style={‘height’: ‘50vh’}, center=[centerLat,centerLon],
zoom=zoom, id=‘mapdams’
only the second one is shown. Inverting the order of the layers I see Google map. On the right a layer selection appears but as the layers do not have a name they canno be seen in the control. How can I name the tile layers so that I see them in the control ? Also, is it possible to have them as mutually exclusive ? Is this the right way to have more layers ?


After googling I found the solution that is the following,

                   dl.BaseLayer(dl.TileLayer(url="{x}&y={y}&z={z}"),name='Google Map Sat.'),
                   dl.BaseLayer(dl.TileLayer(),                                                                     name='Open Street Map',checked=True)

that is using the BaseLayer, which also have a name propertyy and works as mutually exclusive

1 Like