我正在使用Python中的folium包来构建这个链接中的地图:GeoAdmin地图链接
在创建基本地图时,我使用:
map_geo = folium.Map(location=[47.46901, 9.36688], zoom_start=13)然后尝试将该层添加为wms层:
folium.raster_layers.WmsTileLayer(url = 'https://wms.geo.admin.ch/?',
layers = 'ch.bfe.fernwaerme-nachfrage_wohn_dienstleistungsgebaeude',
transparent = False,
control = True,
name = 'energy',
overlay=True,
show = True,
).add_to(map_geo)
folium.LayerControl().add_to(map_geo)最后,最终的地图看起来是:

如果我从层控件中单独选择基本层,那么我就可以看到它。但是如果我激活能量消耗层,背景层就会变成白色。我做错了什么?
谢谢
发布于 2022-07-15 13:54:07
我不知道这样的图层可以放在一起。我对您的代码进行了反复尝试,查看了参考文献中的示例。为了解决这个问题,我对图层的图像进行了格式化,并对其进行了改进。
import folium
map_geo = folium.Map(location=[47.46901, 9.36688], zoom_start=13)
folium.raster_layers.WmsTileLayer(url = 'https://wms.geo.admin.ch/?',
layers = 'ch.bfe.fernwaerme-nachfrage_wohn_dienstleistungsgebaeude',
transparent = True,
control = True,
fmt="image/png",
name = 'energy',
overlay = True,
show = True,
).add_to(map_geo)
folium.LayerControl().add_to(map_geo)
map_geo

https://stackoverflow.com/questions/72992020
复制相似问题