Avoid geocode limit on custom google map with multiple markers

前端 未结 2 534
猫巷女王i
猫巷女王i 2020-12-08 12:42

I\'ve created a custom map with around 150 markers. It only plots around 20 or so before it hits the geocode limit.

What can I incorporate into my code to avoid hitt

2条回答
  •  清歌不尽
    2020-12-08 13:23

    So instead of sending all the requests almost instantly in a for-loop, I thought it might be better that when a geocode returns a result, to send the next one. If the result coming back is a OVER_QUERY_LIMIT, resend the request with an increase on the delay. I haven't found the sweet spot timeout that produces the fewest OVER_QUERY_LIMIT's, but at least it will create all the markers (for valid addresses). It takes about 45 seconds or so to finish on my machine.

    
    
    
    
    
    
    
    
    

提交回复
热议问题