Python地理地圖可視化folium標(biāo)記點(diǎn)彈窗設(shè)置代碼(推薦)
發(fā)布日期:2022-01-30 09:03 | 文章來源:源碼中國
python代碼如下:
import webbrowser as wb
import folium
if __name__ == '__main__':
loc = [30.679943, 104.067923] # 成都中心位置經(jīng)緯度
map = folium.Map(location=loc,
zoom_start=11,
zoom_control=True,
tiles='OpenStreetMap') # 默認(rèn)OpenStreetMap
s1 = '地理位置標(biāo)記點(diǎn)上的彈出窗口,展示標(biāo)記點(diǎn)數(shù)據(jù)內(nèi)容'
s2 = 'zhang phil'
s3 = 'https://zhangphil.blog.csdn.net/'
WIDTH = max(len(s1.encode('utf-8')), len(s2.encode('utf-8')), len(s3.encode('utf-8')))
pop = folium.Popup(html=folium.Html("""
{}</br>
{}</br>
{}</br>
""".format(s1, s2, s3),
script=True,
width=WIDTH * 4),
parse_html=True,
max_width=3000,
)
# 添加一個標(biāo)記,然后設(shè)置彈窗。
folium.Marker(
location=loc,
popup=pop,
tooltip="標(biāo)記點(diǎn)"
).add_to(map)
map.save('map.html')
wb.open('map.html')
# https://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/Popups.ipynb
輸出結(jié)果如圖:

到此這篇關(guān)于Python地理地圖可視化folium標(biāo)記點(diǎn)彈窗設(shè)置代碼(推薦)的文章就介紹到這了,更多相關(guān)Python地圖可視化folium內(nèi)容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章
上一篇:
關(guān)注官方微信