Skip to content

Using Geocoder::geocode within a loop gets Server Time Out. #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emarino0411 opened this issue Mar 8, 2016 · 2 comments
Closed

Using Geocoder::geocode within a loop gets Server Time Out. #43

emarino0411 opened this issue Mar 8, 2016 · 2 comments

Comments

@emarino0411
Copy link

emarino0411 commented Mar 8, 2016

Hi I have this code:

foreach ($results as $result) {
$barangay = DB::table('rbrgy')->where('bgycode', $result->barangay)->first();
$loc = getBrgyName($barangay->bgycode) . ', '
. getCityName($barangay->citycode) . ', '
. getProvName($barangay->provcode) . ', '
. getRegion($barangay->regcode) . ', '
. 'Philippines';
$geocode = Geocoder::geocode($loc);
}

When the $results array is <= 10, it works fine but when $results is > 10, the I get a server timeout. Is there a way on how I can get multiple geocodes with one function call?

Please help. Tried searching the issues but there seems to be no issues related to this. Thanks in advance!

~May

@mikebronner
Copy link
Member

Hi @emarino0411, can you provide more details:

  • which adapter are you using?
  • which provider are you using?

I have found that adding a wait time of 250ms between each request for GoogleMaps aleviates this (they rate-limit their APIs) -- other providers may do that as well.

@mikebronner
Copy link
Member

Closing for now, no response. Please re-open if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants