Closed ghost closed 6 years ago
Same issue here
I am also having the same problem. reverse()
returns an empty collection. No error messages
The link @xperiuminc posted using my API key returns the correct json data.
I'll look into this, thanks for reporting.
@xperiuminc @brentscholl @hassan-bazzi I am unable to reproduce this error. My initial suspicions is that there is something wrong with your config file, or you have exceeded Google's API limit. I tried your exact query above app('geocoder')->reverse(52.773613,-108.297923)->get()
and got results. I'm not sure if your locale setting might affect this if you have it set to something other then the default (English, United States).
I will close this for now, as this does not appear to be an issue with the package itself. If you can provide further information that would help troubleshoot this, please feel free to reopen.
Shouldn't there at least be some sort of error thrown? Not sure how I can go about troubleshooting this problem.
@xperiuminc The package isn't erring out ... it is probably getting an empty result set back from the provider (Google Maps, I presume). The package has no way of knowing an error occurred. Double-check that the API token is set correctly, as well as Google Developer Console to make sure you haven't exceeded your quota.
For anyone who stumbles on this. I was able to solve this problem by using Laravel Homestead instead of wamp.
I was using Wamp and php artisan serve
to serve the site on my local machine. The problem may be with wamp.
After switching to Laravel Homestead using Vagrant and Virtual Box, app('geocoder')->reverse(52.773613,-108.297923)->get()
works
I'm not sure what was causing the problem in wamp. If it is possible to add more error messages to this package, that may be helpful for future developers.
For what it's worth, I had this issue and it was indeed due to incorrectly configured google maps API key.
However, even though I've resolved the problem with the API key, I'm still getting null
/ empty collection returned for the lat,long that I was testing with — If I change even one decimal place, I get results.
I'm presuming this has something to do with cached results, however I still get empty results for those original coordinates, even after running php artisan cache:clear
.
General Information
GeocoderLaravel Version: 4.0 Laravel Version: 5.6 PHP Version: 7.2.4 Operating System and Version: WAMP on Windows 10
Issue Description
app('geocoder')->reverse(52.773613,-108.297923)->get()
is returning an empty collection.app('geocoder')->geocode('5.43.168.58')->get()
works fine.The problem is when I try to do a
reverse()
I have followed documentation for install, I ensured my API key allows Geocoding API, and have given access to my IP.
I have tried clearing cache, composer dump-autoload. Still no luck. No matter what I do I get an empty collection.
I tried using the url https://maps.googleapis.com/maps/api/geocode/json?latlng=52.773613,-108.297923®ion=en-US&key=[MY_API_KEY] to see if it is my API key causing the problem, but I get the proper data returned based on the coordinates using that url.