Jump to content
TNG Community
gracielou

Geocode "Communication Failed"

Recommended Posts

gracielou

I’m running TNG v 12.1 locally on my laptop on a XAMPP stack.

Google maps works fine on the site, however the Places > Geocode feature isn’t working. When I try to use it a message "Communication Failed" appears next to each place. I know that some of my places don’t conform to a strict city/county/state/country format, so I wouldn't be surprised if they are skipped over them or they generate errors. But even the places that do conform to the conventional format aren't getting geocoded.

I have done the following to set up my Google maps API key:

I have set up an API key that can call these APIs

  • Geocoding API
  • Maps JavaScript API
  • Maps Embed API
  • Maps Static API

I have set up "localhost" as the web restriction.

I have enabled each API.

I have a google account activated with a credit card on file.

I have entered the API key on the Setup>Configuration>Map Setting page in the admin section of TNG.

In addition

As I say, google maps works fine. But the batch geocoding feature doesn’t work.

Thoughts?

Thank you.

communication failed.jpg

API-restrictions.jpg

web-restrictions.jpg

map-key-defined-map-setttings.jpg

Share this post


Link to post
Share on other sites
Rob Severijns

Deleted 

Share this post


Link to post
Share on other sites
Michel KIRSCH

If you don't found a solution, you can use the OSM automatic geocode Mod.  https://tng.lythgoes.net/wiki/index.php?title=OSM_Automatic_Geocoding

It uses the nominatim geocoding facilities instead the google facilities, with or without Google maps key

Michel

Share this post


Link to post
Share on other sites
gracielou
9 hours ago, Michel KIRSCH said:

If you don't found a solution, you can use the OSM automatic geocode Mod.  https://tng.lythgoes.net/wiki/index.php?title=OSM_Automatic_Geocoding

It uses the nominatim geocoding facilities instead the google facilities, with or without Google maps key

Michel

Thanks, Michel! I’m hoping someone might have an idea of whats going on. But if not, it’s nice to know there’s something else I can try.

Share this post


Link to post
Share on other sites
gracielou

I think this has something to do with running TNG on my local machine. I have another TNG license and run it on a hosting service and I do not get the Failed Communication error when running it on my hosted site.

Still, if anyone has insights on how to fix on a local machine, would appreciate it. 

Thanks!

Share this post


Link to post
Share on other sites
Michel KIRSCH
1 hour ago, gracielou said:

running TNG on my local machine

Can you use the same Google key on two different IPs? I don't think it's possible...

Michel

Share this post


Link to post
Share on other sites
Ken Roy

I have not obtained a Google Maps key in a long time, but if I remember correctly I had one key for my localhost and a different key for my hosted production and test subdomains where the key was tied to royandboucher.com

Share this post


Link to post
Share on other sites
gracielou

I created separate API keys for my two installations (production and sandbox) to see if that fixed the problem. As was before, google maps is working in my sandbox, but the geocoding feature isn't. I've also been messing around with the website restrictions, and have defined the following:
localhost
http://localhost
http://localhost/*

None of the above worked.

I checked MyPhpAdmin and it's using port 80 for http requests. There's some debate online on how to append localhost with the port number, so I'll try the following, one at a time, to see if any of them work. 

http://localhost:0080
http://localhost:0080/* 
http://localhost:80
http://localhost:80/*

Will report back.

Thanks to all for your ideas and input!
 

Share this post


Link to post
Share on other sites
Ken Roy

There are separate APIs you need to check for geocoding as documented in Google Maps - Getting Started

Share this post


Link to post
Share on other sites
gracielou
4 minutes ago, Ken Roy said:

There are separate APIs you need to check for geocoding as documented in Google Maps - Getting Started

Yes! The ones described on that page are the ones I'm using. And I've double-checked that they are activated.

BTW, I'm finding out that my attempts at geocoding my Places, though unsuccessful, count towards my quota! I think it's $5 for every 1000 hits -  something to be aware of. I've just been picking the number of places to geocode from the drop-down list (10, 50, 250, etc.) indiscriminately. I'll stick with 10 until I get things figured out :)

Still testing...

Share this post


Link to post
Share on other sites
Ken Roy

Maybe a dumb question but did you request a V2 API key?

Share this post


Link to post
Share on other sites
theKiwi
1 hour ago, gracielou said:

I checked MyPhpAdmin and it's using port 80 for http requests. There's some debate online on how to append localhost with the port number, so I'll try the following, one at a time, to see if any of them work. 

http://localhost:0080
http://localhost:0080/* 
http://localhost:80
http://localhost:80/*

Port 80 is the default port, so no need to specify it after the localhost

Roger

Share this post


Link to post
Share on other sites
Michel KIRSCH

In some circumstances, localhost is not always recognized. I had the problem with

EasyDevServer where i must use the IP 127.0.0.1 instead localhost...

Don't know if that helps....

Michel

Share this post


Link to post
Share on other sites
gracielou
18 hours ago, Ken Roy said:

Maybe a dumb question but did you request a V2 API key?

Not that I am aware. Had to look up what a V2 API key is. I just picked a standard API key that I (don't) believe needs any additional authentication.

Share this post


Link to post
Share on other sites
gracielou

Update...

Still not working. 

I have tried all of these web restrictions:

localhost
http://localhost
http://localhost/*

http://localhost:0080
http://localhost:0080/* 
http://localhost:80
http://localhost:80/*

http://127.0.0.1
http://127.0.0.1/*

I also tried restricting by IP address:

127.0.0.1

I also tried removing any and all restrictions (selecting None).

I also disabled my pop-up blocker/adblockplus because I know it can cause things not to work.

Very strange.

What's odd is that I am getting the message "Communication Failed." However, my attempts at Geocoding are getting through because they are being counted towards my daily quota. So the request is being sent to the Google API and received by the Google API,  but there's some sort of processing problem with the response from the Google AP?

 

Share this post


Link to post
Share on other sites
Ken Roy

The Google Maps - Getting Started article shows use of only localhost for the registration URL.  (no http:// - added by edit)

I do not know XAMPP since I could never get it working on a 64-bit machine years ago,  So I am using WampServer and as Michel indicated you need to have taken action to get localhost to get recognized.  I also have not done any geocoding in years other than one location at a time using the Geocode Assistant Mod

Have you tried restricting it to 1 entry and check what gets shown in the Inspect Element - Console

It is always difficult to debug local server errors when we cannot access the site

Edited by Ken Roy
Clarify information

Share this post


Link to post
Share on other sites
gracielou
17 minutes ago, Ken Roy said:

The Google Maps - Getting Started article shows use of only localhost for the registration URL.  (no http:// - added by edit)

I do not know XAMPP since I could never get it working on a 64-bit machine years ago,  So I am using WampServer and as Michel indicated you need to have taken action to get localhost to get recognized.  I also have not done any geocoding in years other than one location at a time using the Geocode Assistant Mod

Have you tried restricting it to 1 entry and check what gets shown in the Inspect Element - Console

It is always difficult to debug local server errors when we cannot access the site

I changed the web restrictions back to just localhost, waited 5 min (as suggested in the Google Cloud Console), and tried it again. Here's a screenshot of the Chrome console. Oh, forgot to mention I also tried using FireFox to see if it was an issue with Chrome, but I get the same results in FireFox.

chrome-console-comm-failed.jpg

Share this post


Link to post
Share on other sites
gracielou

Thanks again everyone for your input. I think I'm going to try to use the OSM automatic geocode Mod that Michel suggested. Probably won't get to it for a few days. Will let you know how it goes and if it works on my local install.

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

×