gmplot标记在标记256点后不起作用

问题描述 投票:0回答:1

我正在尝试使用gmplot在地图上标记一堆点,并观察到在某个点之后它将停止标记并清除所有先前标记的点。我调试了gmplot.py模块,发现当点数组的长度超过256时,这发生了而没有给出任何错误和警告。

self.points = [] on gmplot.py

由于我是Python和OOP概念的新手,有没有一种方法可以覆盖它并标记超过256点?

python-3.x gmplot
1个回答
0
投票

您使用的是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点,因为我知道数组的位置是从0开始,所以我可以用str(464) <formataddress(464)>来获得标题。>

如果使用Windows,请确保检查GitHub站点以修改gmplot文件。

© www.soinside.com 2019 - 2024. All rights reserved.