Python地理地图可视化folium标记点弹窗设置代码(推荐)
作者:zhangphil 时间:2022-08-18 17:02:57
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("""
{}</br>
{}</br>
{}</br>
""".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
输出结果如图:
来源:https://zhangphil.blog.csdn.net/article/details/110901829
标签:Python,地图,可视化,folium,弹窗
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python + selenium自动化环境搭建的完整步骤
2023-11-19 12:42:57
![](https://img.aspxhome.com/file/2023/7/65987_0s.png)
python使用分治法实现求解最大值的方法
2021-07-14 12:06:09
SQL Server数据库服务器高性能设置
2010-11-25 16:00:00
CentOS 5.5使用yum来安装LAMP(php运行环境)
2023-11-14 12:15:52
python样条插值的实现代码
2022-05-11 16:04:05
![](https://img.aspxhome.com/file/2023/3/70833_0s.png)
匹配 IP 地址与域名的正则表达式
2023-06-17 05:55:48
不错的广告定位效果代码
2009-06-05 18:51:00
网页制作了解什么是CSS hack?
2007-10-21 08:52:00
CSS扫盲(一): padding
2009-08-04 17:58:00
CSS实现HTML元素透明的那些事
2010-02-01 12:34:00
JSONObject.toString
2008-03-09 19:12:00
golang 使用sort.slice包实现对象list排序
2023-06-21 18:25:46
![](https://img.aspxhome.com/file/2023/2/87612_0s.png)
CentOS 6.5中安装Python 3.6.2的方法步骤
2022-10-11 09:13:43
详解微信小程序文件下载--视频和图片
2023-08-10 16:38:50
Python 解决空列表.append() 输出为None的问题
2023-07-24 14:07:57
Dreamweaver MX技巧之超链接
2009-05-29 18:40:00
![](https://img.aspxhome.com/file/UploadPic/20072/200723113349643s.jpg)
Python中字符编码简介、方法及使用建议
2021-10-11 21:58:33
python实现百度关键词排名查询
2023-01-19 12:26:58
黄相如:如何做好用户体验
2008-06-04 17:34:00
特别推荐:Web开发常用速查手册大全(100+)
2011-05-06 12:44:00