Google Maps not load correctly

cancel
Showing results for 
Search instead for 
Did you mean: 
billydekid
Established Member II

Google Maps not load correctly

Hi,

I recently have a strange problem when any photos with geo-tagging unable to load into Google Maps.

From Javascript console, the error message was clear: MissingKeyMapError (see file attached)

I try to delete /share folder but still no luck.

Following are my Alfresco version (installed on CentOS 7):

Alfresco Share v5.2.e
(r135148-b16, Aikau 1.0.101.3, Spring Surf 5.2.e, Spring WebScripts 6.13, Freemarker 2.3.20-alfresco-patched, Rhino 1.7R4-alfresco-patched, Yui 2.9.0-alfresco-20141223)
Alfresco Community v5.2.0
(r135134-b14) schema 10005
Thank you,
[bayu]
5 Replies
calvo
Senior Member

Re: Google Maps not load correctly

Hi,

Google Maps needs API Key to consume this services.

In my case, I solved this issue as follows:

First we have to generate our APIKey form Google. More information:
https://developers.google.com/maps/documentation/javascript/get-api-key?hl=ES

After that, the quick solution (maybe not the best) is to modify this files (the best option is to extend share):
[Alfresco]\tomcat\webapps\share\components\geographic\google-map.js
[Alfresco]\tomcat\webapps\share\components\geographic\google-map-min.js

In both files, when we make a request to Google Maps, we will add a parameter "key=OUR_API_KEY", so the url will be:

script.src = window.location.protocol + "//maps.google.com/maps/api/js?sensor=false&key=OUR_API_KEY&callback=Alfresco.component.GoogleMap.Callback";

Regards,

billydekid
Established Member II

Re: Google Maps not load correctly

Hi calvo _

On my previous/other installation -- and I was thought it was default configuration -- that API Key is not required, until this happened.

Actually the correct map was loaded for a milliseconds, and then switched to error page.

This View a file on Google Maps | Alfresco Documentation also not mention about the API Key to view a file on Google Maps.

Anyway thanks for your tricks.

[bayu]

calvo
Senior Member

Re: Google Maps not load correctly

Hi Bayu Widyasanyata‌,

Me too. I had the same behaviour "the correct map was loaded for a milliseconds, and then switched to error page", so I changed that couple of files and it works (version 201704).

Anyway, I will appreciate any other solutions from the community :-)

Thank you so much

Regards,

billydekid
Established Member II

Re: Google Maps not load correctly

Hi calvo _‌,

Following some points after my little research on my platform:

  • Virtualbox, host: Win10, guest: Ubuntu 16.04.2; 2 network ethernets: 1 bridged adapter with DHCP 192.168.1.0/24; and 1 for host only adapter 192.168.56.101;
  • Alfresco accessing with localdomain (e.g. http://alfresco.dev:8080/share/page) and this URI was put on my Windows' hosts file (as local DNS) >> e.g.: 192.168.56.101 mapped to alfresco.dev.

Here are the results:

  1. Both version 201704 & 201702, running on default ports (8080), accessing with localdomain (not IP address) are unable to load Google Maps; but accessing with IP is success.
  2. My another Alfresco installation with NginX as reverse proxy (port 80 and 443) to Alfresco (8080 and 8443) is success to access geotagging file format.

I haven't known yet why IP address and NginX has the right-answer for the problem. :-(

Thank you,

[bayu]

billydekid
Established Member II

Re: Google Maps not load correctly

I want to update my latest research regarding this issues:

I then add nginx onto one of my installation (201704) which I expect will solve the issue. The result is fail. URI accessed is alfresco.dev.

But when I changed to same uri/hostname (alfrescoecm.dev) with another alfresco which successfully loaded Google Maps, then the photo can be loaded normally. (point #2 on my answer above)

So, it looks my hostname (alfrescoecm.dev) is already "white-listed" by Google Maps to access without key ("anonymous").

For my another machine hosted on Internet, this problem is not affected.

Hence, summarizing: problems found on localdomain hostname which hasn't been "registered"/"whitelisted" to Google Maps API key.

If anyone has another experiences and solutions, pls share... Thanks,