开发者

reverse Geocoding with multiple requests at a time

I have tried reverse Geocoding with multiple requests at a time... My coding is below:

var latlon=new Array();
var lname="";
latlon[0]=new arra开发者_StackOverflow社区y("11.19","71.20");
latlon[1]=new array("12.89","72.22");
latlon[2]=new array("13.49","73.64");
for(i=0;i<3;i++)
{
 lname=locationname(latlon[i][0],latlon[i][1]);
 alert(lname);
}

function locationname(lat,lon)
{
        var llng = new google.maps.LatLng(lat,lon);
       ligeocoder.geocode({'latLng': llng}, function(results, status)
       {
            if (status == google.maps.GeocoderStatus.OK)
            { 
                if (results[0]) 
                {
                    loname=results[0].formatted_address;
                }
                else
                {
                    alert("result failed");
                }
            }
            else
            {
                alert("Geocoder failed due to: " + status);
            }
        });
}

It shows error: Geocoder failed due to: OVER_QUERY_LIMIT


This is a limit of the Google geocoding API, not javascript. Basically google will not let you make too many requests at a time, there is no way to get around this limit without breaking the google api terms of service.

If you want to limit the amount of calls you're doing at a time, put your geocoding function in a setInterval.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜