Rails + geocodes: Finding latitude and longitudes for 20k addresses

211 Views Asked by At

I am using the geocoder gem for working with geolocation data. Now, I have a list of 20k addresses and I to find for them their latitude and longitude coordinations. I am using for this Bing Maps, which allows to send 125k requests per day. So that's good.

But there's a problem - because when I send quickly a few requests through geocoder to decode some addresses, instead of returning the addresses it returns an empty array (nothing).

I think it's because of sending too many requests within a very short period of time. So I was thinking about putting there a delay between making those calls to geocoder, like:

sleep 3 # pause for 3 seconds

This is just a thought - how big should be the pause between the calls of geocoder? Or is there any better way to process 20k of data with using geocoder?

Thank you

1

There are 1 best solutions below

0
On

Unless this is for a Windows app the limit is 125,000 a year. Windows apps can do 50,000 a day. Note that non-enterprise accounts are rate limited. When you make too many requests in a short period of time an empty response will be returned and a flag in the header will indicate that the request was rate limited. This is documented here: http://msdn.microsoft.com/en-us/library/ff701703.aspx