python-3.x - gmplot 标记在标记 256 点后不起作用
问题描述
我正在尝试用 gmplot 在地图上标记一堆点,并观察到在某个点之后它会停止标记并清除所有先前标记的点。我调试了 gmplot.py 模块,发现当点数组的长度超过 256 时,会发生这种情况而没有给出任何错误和警告。
self.points = [] on gmplot.py
由于我对 Python 和 OOP 概念非常陌生,有没有办法覆盖它并标记超过 256 分?
解决方案
您使用的是gmplot.GoogleMapPlotter.Scatter
还是gmplot.GoogleMapPlotter.Marker
。我使用了其中任何一个,并且能够为465
我正在从事的项目获得积分。这可能是您的 API 密钥问题吗?
我的代码的部分片段
import gmplot
import pandas as pd
# df is the database with Lat, Lon and formataddress columns
# change to list, not sure you need to do this. I think you can cycle through
# directly using iterrows. I have not tried that though
latcollection=df['Lat'].tolist()
loncollection=df['Lon'].tolist()
addcollection=df['formataddress'].tolist()
# center map with the first co-ordinates
gmaps2 = gmplot.GoogleMapPlotter(latcollection[0],loncollection[0],13,apikey='yourKey')
for i in range(len(latcollection)):
gmaps2.marker(latcollection[i],loncollection[i],color='#FF0000',c=None,title=str(i)+' '+ addcollection[i])
gmaps2.draw(newdir + r'\laplot_marker_full.html')
我可以将鼠标悬停在第 465 点上,因为我知道它的大致位置,并且我能够使用 获得标题str(464) <formataddress(464)>
,因为我的数组是从 0 开始索引的
确保检查 GitHub 站点以修改 gmplot 文件,以防您使用 Windows。
推荐阅读
- swift - Google Cloud IoT:如何从用 Swift 编写的 iOS 应用程序连接到 MQTT 桥接器?
- sql - SQL Server - 操作值以创建字符串
- r - 急诊室R模拟程序问题
- java - 使用 Java 代码生成空白报告,在 Studio 中预览 OK
- react-native - React 原生表单设计
- scheme - 方案查找列表的平均值
- python - Beautifulsoup 在解析前转义无效的 xml 字符
- elasticsearch - 将 Kibana(弹性搜索)嵌入 WordPress?
- .htaccess - 通过删除参数问号重定向某些子文件夹
- php - 向轮播添加 Alt 标签