Jump to content
TNG Community
anderson.mc

Geocode Problems

Recommended Posts

anderson.mc

Running TNG 12.0.3 with Google Maps API

When making new geocode requests the following error is returned "Could not be geocoded (REQUEST_DENIED)". There is no problem with places already geocoded, or with place where I enter geocode information manually. Only when making a batch request. This is a relatively new problem - the last month or so. Anybody have any suggestions?

Thanks! Mark

Share this post


Link to post
Share on other sites
Ken Roy

Mark,

Take a look at the TNG Wiki article on Google Maps - Getting Started  You may need to activate the Places part of the Google Maps ApI for geocoding to work

Share this post


Link to post
Share on other sites
Arnaud

I noticed a change some days ago as well. Same problem. In addition to "Maps Javascript API" you also need to enable "Places API for Web" and "Geocoding API". Based on the problem you describe, I think the last ("Geocoding API") might be missing in your setup. At least for me this fixed the problem.

Share this post


Link to post
Share on other sites
anderson.mc

Thank you Ken Roy and Arnaud for your suggestions. I have confirmed that all the APIs that you indicated are enabled. I am still having the same problem.

Interesting observation: The Google Cloud Platform allows me to monitor the API requests and errors for all the enabled APIs. The Geocoding API shows a significant number of requests and an identical number of errors. The only other API showing any activity is the "Maps Javascript API" which shows a significant amount of requests and no errors. This makes sense because the places that already have GPS coordinates are displaying maps as requested.

I am open to any suggestions.

Thanks again. Happy New Year!

..Mark

Share this post


Link to post
Share on other sites
Arnaud

Hi Mark,

you might want to check that the enabled API's  have the correct restrictions. This is done under credentials.

Application restrictions

- I restrict the usage to just my webiste only, in a format https://my.website.eu/*

API restrictions
- Geocoding API
- Maps JavaScript API
- Places API
With the API enabled, but without the key restrictions set correctly, you will see the request and error counter go up.

Share this post


Link to post
Share on other sites
anderson.mc

Well, I have tried all suggestions and, so far, no improvement. I am still getting a "Request Denied" whenever I perform a Geocode request.

If anyone thinks of something, please let me know. Otherwise, I have to look up each place manually.

Thanks again,

..Mark

Share this post


Link to post
Share on other sites
Ken Roy

Mark,

You need to use Firefox Inspect and look at the Console for why the request is being denied.

Share this post


Link to post
Share on other sites
Scott_Pryer

Mark

Last summer I started seeing that same error and had to get a new API code from Google to solve the issue.  Since then I have not had any issues.

Scott

Share this post


Link to post
Share on other sites
Arnaud

Hi,

not sure whether you were able to fix it at the end, but it seems other users experience the problem as well. Apparently Google made a change. Here are two screenshots I took when creating a new project. I enabled the three highlighted API's. They are all in the maps library. The other screenshots shows the API restrictions. Make sure the usage of the enabled API's is not restricted. I recommend using also the url of your website as a referrer, to tighten security. I use referrer HTTP in a format https://my.website.com/*

Regards,
Arnaud

Here's a screenshot of the API library. The three API keys to enable can all be found under maps.

API-selection.jpg

The restrictions can be found under Credentials.

API-restrictions.jpg

 

 

Share this post


Link to post
Share on other sites
Ken Roy

Arnaud,

Would you mind updating the Google Maps - Getting Started article on the TNG Wiki.   My maps continue to work but I have not registered a credit card, so I have not captured completely the screens on the Google site. 

I have not attempted to use bulk geocoding in a long time so maybe that no longer works on my site, nor have I tried to geocode individual places in a long time, but I do not want to disturb a sleeping dog just to capture screens for the TNG Wiki article that most people never read anyway.

thanks,

Share this post


Link to post
Share on other sites
Arnaud

Hi Ken, sure no problem. I was able to use the google maps much longer than others, before having to go through the process of setting up a key. I don't know what logic is being applied for the roll-out of changes. This one was hitting me pretty early. I will take some more screenshots and update the wiki, maybe later today.

 

Share this post


Link to post
Share on other sites
anderson.mc

Well guys, I just don't know what to do with this. I followed all your suggestions. I then deleted the API that I was using and created a new one. I registered the site with Google. I specified an http referrer. I tried listing the APIs without restrictions...

All to no avail. If the geocode is in place, the maps are displayed just fine.

The batch geocoding still returns the same message  "Could not be geocoded (REQUEST_DENIED)"

Do you know if others that have reported issues have been able to solve the problem?

Thanks again for all your attention to this.

..Mark

Share this post


Link to post
Share on other sites
anderson.mc

Another interesting thing...

When I run the batch command and then select "Edit" on the "Request Denied" line, it takes me , of course, to the address edit screen.

Then, I select "Show/Hide clickable map", which then populates the correct map location and GPS coordinates. I then click "Save" and everything is fine for that place address. It just requires of me to manually select and edit each address.

...

Share this post


Link to post
Share on other sites
Arnaud

I did not test the batch geocode function, I already had the REQUEST_DENIED error on the individual place edit screen. That I fixed by enabling the geocoding API.

I just now tested the batch geocode function and can confirm I get the same error message. Let me look into it.

Share this post


Link to post
Share on other sites
Scott_Pryer

Looking through my notes on how I was able to get geocoding to work I also followed this suggestion:

2019-01-06 14_15_28-fix for geocoding.txt - Notepad.jpg

Share this post


Link to post
Share on other sites
Arnaud

In my geocodelib.php I already had this syntax (non-modified, just using the latest updates):

$base_url = "{$http}://maps.googleapis.com/maps/api/geocode/xml?key=" . $map['key'];

The geocoding for individual places does work. It's the batch geocoding generating this error.

On the google cloud platform I do see the errors increase for the geocoding API application, indicating it is indeed the right API being enabled for this function.

Using the IP addresses of my server (both the IPv4 and IPv6 address) instead of the HTTP referrer as application restriction gives better results, but still no 100% success rate. I now get coordinates for roughly 90% of the requests..

Share this post


Link to post
Share on other sites
eFFemeer

I have the same problem as Arnaud but even "Using the IP addresses of my server (both the IPv4 and IPv6 address)" doesn't help.

Finally solved my problem: apparently the Geocode API doesn't work if and when "Application restrictions" are applied.
I had the impression that removing them might take some time. So be patient.

Edited by eFFemeer
problem finally solved

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×