Python地理地图可视化folium标记点弹窗设置代码(推荐)

python代码如下:

import webbrowser as wb
import folium
 
if __name__ == '__main__':
    loc = [30.679943, 104.067923]  # 成都中心位置经纬度
    map = folium.Map(location=loc,
                     zoom_start=11,
                     zoom_control=True,
                     tiles='OpenStreetMap')  # 默认OpenStreetMap
 
    s1 = '地理位置标记点上的弹出窗口,展示标记点数据内容'
    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("""
                            {}
{}
{}
""".format(s1, s2, s3), script=True, width=WIDTH * 4), parse_html=True, max_width=3000, ) # 添加一个标记,然后设置弹窗。 folium.Marker( location=loc, popup=pop, tooltip="标记点" ).add_to(map) map.save('map.html') wb.open('map.html') # https://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/Popups.ipynb

输出结果如图:

Python地理地图可视化folium标记点弹窗设置代码(推荐)_第1张图片

到此这篇关于Python地理地图可视化folium标记点弹窗设置代码(推荐)的文章就介绍到这了,更多相关Python地图可视化folium内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

你可能感兴趣的:(Python地理地图可视化folium标记点弹窗设置代码(推荐))