[英]How can I insert png symbol into web map legend with folium-python 3
此代碼是使用 folium 模塊生成 web map 的其他大代碼的一部分:
legend_html = '''
<div style="position: fixed;
bottom: 40px; left: 50px; width: 100px; height: 110px;
border:2px solid grey; z-index:9999; font-size:14px;
background-color: white;
"> Legend <br>
aaa <i class="fa fa-map-marker" style="color:blue"></i><br>
bbb <i class="fa fa-truck" style="color:pink"></i><br>
ccc <i class="fa fa-map-marker" style="color:green"></i><br>
shapefile <img src= r"D:\GIS\sdr\abc.png" width="10" height="10">
</div>
'''
在 shapefile 行中,我嘗試使用來自以下位置的 png 文件來描述圖例中的 shapefile 多邊形:D:\GIS\sdr\abc.png
當我運行代碼時 - 生成了 web map,但在圖例中我看不到 png 符號
我發現了這個解決方案:添加一個 url 圖像而不是從 PC 硬盤添加它:
shapefile <img src= 'https://some link to url/aaa.png' width="20" height="20">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.