Reputation:
I am creating an app in which it is needed to convert a street number to latitude and longitude so it can be shown on a map. I decided I would use Google's Geocoding API.
For starters - I created a basic application in a console which would convert a given street number to a latitude and longitude value.
I also created an API key in the Google API Console.
Geocoding.IGeocoder geocoder = new GoogleGeocoder() { ApiKey = "my api key" };
IEnumerable<Address> addresses = await geocoder.GeocodeAsync("1600 pennsylvania ave washington dc");
Console.WriteLine("Formatted: " + addresses.First().FormattedAddress);
Console.WriteLine("Coordinates: " + addresses.First().Coordinates.Latitude + ", " + addresses.First().Coordinates.Longitude);
Console.ReadKey();
When running the app - I get the following exception:
Geocoding.Google.GoogleGeocodingException: 'There was an error processing the geocoding request. See Status or InnerException for more information.'
There was no information in the InnerException - so I checked the status and it said this:
RequestDenied - thankfully this was a common problem - so I went to the following page to find a solution:
So first of all I made sure that the Places API was enabled/activated in the Google Cloud Console - it was activated.
I checked whether there were any issues with my key parameter - but I couldn't find any issues - it seemed to be fine. I generated a new api key just in case and it still did not work.
I also checked whether the API key had been correctly setup - I created a new API key that was unrestricted and I was still getting the same problem.
I've followed every step here and once again I am still getting the same problem: Request Denied.
I don't know if I am missing a really important step, but for now I have no idea what to do. I have tried for hours upon hours to fix this but to no avail.
I don't know what the root of the problem is - I am offering 100 reputation to whoever can help me.
Thanks,
tommy99
Upvotes: 2
Views: 725
Reputation: 287
As stated by @emert117 you might have reached usage limit. Moreover, Google has limited services in certain countries and for certain IP addresses. You might need to make sure requests don't go through a VPN or Proxy with a restricted IP address or don't originate from restricted countries.
These thread might have more helpful comments though:
Upvotes: 0
Reputation: 1498
How many requests do you send in a second? I found this usage limit in the usage limit documentation
While you are no longer limited to a maximum number of requests per day (QPD), the following usage limits still apply when using the Places API:
Rate limit is 100 requests per second (QPS). It is calculated as the sum of client-side and server-side requests for all applications using the credentials of the same project.
Upvotes: 1