我试图用gmplot在地图上标记一堆点,观察到在某个点之后,它会停止标记,并清除所有以前标记的点。我调试了gmplot.py模块,发现当点数组的长度超过256时,这种情况就会发生,而不会给出任何错误和警告。
self.points = [] on gmplot.py由于我对Python和OOPs概念非常陌生,有没有方法可以覆盖它并标记超过256个点?
发布于 2020-01-01 08:36:55
您使用的是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开始索引的
如果您使用的是windows,请务必查看GitHub站点以修改gmplot文件。
https://stackoverflow.com/questions/58772329
复制相似问题