I use folium to program a leaflet map which I want to customize with an open map from https://sg.geodatenzentrum.de/wms_webatlasde.light_grau. I don't receive an error, but the tile is not displayed: I only get a grey box. I read folium custom map tiles but I still haven't understood how sometimes custom tiles have to be given in a form like:
http://tile.stamen.com/toner/{z}/{x}/{y}.png
http://tile.stamen.com/terrain/{z}/{x}/{y}.jpg
http://tile.stamen.com/watercolor/{z}/{x}/{y}.jpg
I use the map as in the java script source code of the following map: https://www.zdm-emob.de/Kartendarstellung/konzepte.asp. Therefore, I don't get where I went wrong. I assume it could also have something to do with the projection of leaflet and the other map, I tried adjusting but without success.
Here is the code I am using:
import folium
ger = 'https://sg.geodatenzentrum.de/wms_webatlasde.light_grau'
m = folium.Map(location=['51.133333','10.416667'],
tiles = ger,
attr = 'some_attribute',
zoom_start=6)
m
Instead of importing the map as tile in folium.Map one can create a map with a "None" tile. Then, folium.raster_layers.WmsTileLayer can be added to my_map
my_map = folium.Map(tiles=None,min_zoom=6, max_zoom=12, zoom_start=6)
attribute = ('© GeoBasis-DE /<a href="http://www.bkg.bund.de">BKG</a>')
folium.raster_layers.WmsTileLayer(url = 'https://sgx.geodatenzentrum.de/wms_webatlasde.light_grau?',
layers='webatlasde.light_grau',
fmt='image/png',
attr=attribute,
transparent=False).add_to(my_map)