Avoid geocode limit on custom google map with multiple markers

前端 未结 2 535
猫巷女王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:06

    i'm certainly no codemaster, but instead of using a timeout i just keep calling the function from within the function (resource hog i'm sure). i iterate through my counter if i'm successful, otherwise i call my function with the current counter value if unsuccessful. at this rate, i may loop 1000 times for my 37 polylines (or markers if that's what your drawing), but i believe it will finish at the earliest time possible. here's an example - i first call my plot function onclick as plot(0):

    function plot(k)
    {
    ...
    if (status == google.maps.GeocoderStatus.OK)
            {
                draw(r.routes[0]);
                if(k

提交回复
热议问题