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,
)
# 添加一個(gè)標(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
到此這篇關(guān)于Python地理地圖可視化folium標(biāo)記點(diǎn)彈窗設(shè)置代碼(推薦)的文章就介紹到這了,更多相關(guān)Python地圖可視化folium內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!