我一直在看Adding a WMS layer using folium和https://python-visualization.github.io/folium/modules.html。
我设法让上面的链接中的例子在流光中工作,但不是我正在尝试的WMS。我也尝试过在qgis中使用WMS,它可以工作。
我意识到在下面的链接中连接到WMS时,我需要指定坐标系统。据我所知,folium和wms都支持EPSG:900913 = EPSG3857(?)。然而,当添加wms瓷砖层时,我得到的只是我的基本地图。但WMS没有出现。
WMS可在https://resource.sgu.se/dokument/produkter/jordarter-25-100000-wms-beskrivning.pdf https://resource.sgu.se/service/wms/130/jordarter-25-100-tusen找到。
import streamlit as st
import folium
import streamlit_folium
map_geo = folium.Map(location=[57.8,14.14], zoom_start=13, width=1200)
try:
folium.raster_layers.WmsTileLayer(url ='https://resource.sgu.se/service/wms/130/jordarter-25-100-tusen',
layers = ['jord:SE.GOV.SGU.JORD.TACKNINGSKARTA.25K'],
transparent = False,
control = True,
fmt="image/png",
name = 'SGU',
attr = 'im seeing this',
overlay = True,
show = True,
CRS = 'EPSG:900913',
version = '1.3.0',
).add_to(map_geo)
folium.LayerControl().add_to(map_geo)
except Exception as e:
st.write(e)
streamlit_folium.st_folium(map_geo)发布于 2022-08-26 03:12:08
我认为这可能是因为目标URL和图层的命名是不同的。我只是不知道被调用的层是否是预期的层。我从提供的链接内容中获得了这个https://resource.sgu.se/service/wms/130/jordarter-25-100-tusen和层。
import folium
map_geo = folium.Map(location=[57.8,14.14], zoom_start=10, width=1200)
folium.raster_layers.WmsTileLayer(url ='https://maps3.sgu.se/geoserver/jord/ows?',
layers = 'SE.GOV.SGU.JORD.TACKNINGSKARTA.25K',
transparent = False,
control = True,
fmt="image/png",
name = 'SGU',
attr = 'im seeing this',
overlay = True,
show = True,
CRS = 'EPSG:900913',
version = '1.3.0',
).add_to(map_geo)
folium.LayerControl().add_to(map_geo)
map_geo

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