Problems with map display with exhibit/3.1.1/extensions/map/map-extension.js

38 views
Skip to first unread message

George Adams

unread,
Dec 24, 2019, 12:57:41 PM12/24/19
to simile-...@googlegroups.com
A number of years ago I switched from exhibit 2 to v3. All had been working OK for some time but after the recent set of emails I went to check my map at http://www.hayriverti.org/local-directory-map The map displays but is marked "This page can't load Google Maps correctly."
It appears that maps need an API key once again. I went through the steps at  Google Cloud Platform Console to create a key and added it to my code. No change in the map display.


There are multiple problems in the JavaScript console so I checked out
From that file
*  service [google|google2]: which mapping service to draw upon,
 *       defaults to google (v3)
 *  gmapKey: only necessary when using google2 service
I then added the service parameter as google2

This didn't load the map at all.
The code in https://api.simile-widgets.org/exhibit/3.1.1/extensions/map/map-extension.js doesn't pass the gmapKey when using google V3 and doesn't work with version 2

if (Exhibit.MapExtension.params.service === "google2" &&
                   typeof GMap2 === "undefined") {
            if (typeof Exhibit.params.gmapKey !== "undefined") {
	            scriptURLs.push(proto + "//maps.google.com/maps?file=api&v=2&sensor=false&callback=Exhibit.MapExtension.gmapCallback&async=2&key=" + Exhibit.params.gmapKey);
            } else if (typeof Exhibit.MapExtension.params.gmapKey !== "undefined") {
	            scriptURLs.push(proto + "//maps.google.com/maps?file=api&v=2&sensor=false&callback=Exhibit.MapExtension.gmapCallback&async=2&key=" + Exhibit.MapExtension.params.gmapKey);
            } else {
	            scriptURLs.push(proto + "//maps.google.com/maps?file=api&v=2&sensor=false&callback=Exhibit.MapExtension.gmapCallback&async=2");
            }
            if (!Exhibit.MapExtension.params.bundle) {
                javascriptFiles.push("google-maps-v2-view.js");
            }
1. Is exhibit/3.1.1 being maintained?
2. Is there a newer version?
3. Can the code be changed to pass the API map code for google maps v3?
4. This map is not accessed very often. Is it time to remove it from my site?

George Adams

dhinostroza

unread,
Dec 27, 2019, 7:56:49 AM12/27/19
to SIMILE Widgets
Hi,
This is working for me (link instead of script):
    <script src="http://api.simile-widgets.org/exhibit/STABLE/exhibit-api.js"></script>
    <script src="http://api.simile-widgets.org/exhibit/STABLE/extensions/time/time-extension.js" type="text/javascript"></script>
    <link rel="exhibit-extension" href="http://api.simile-widgets.org/exhibit/STABLE/extensions/map/map-extension.js" data-ex-apikey="AIzamykey" />
Best,
Daniel

George Adams

unread,
Dec 27, 2019, 2:32:17 PM12/27/19
to simile-...@googlegroups.com
Daniel,
I have gotten this working thanks to you.
The website referenced above is a Google Sites website. I don't have access to the <head> on any of the pages so am stuck with creating an XML file that defines a Google Gadget. It is a cumbersome work around where I need to use javascript within the XML to add javascript and CSS files to the head.
Below are the changes I made to my XML file to make this work.

I added this function
var includeMapEx = function(url) {
   var link = document.createElement("link");
    link.setAttribute("rel", "exhibit-extension");
    link.setAttribute("type", "text/javascript");
    link.setAttribute("data-ex-apikey", "AIzaSyBl3pTlyHYBW9TGNbsgt9bRqkA8zwHrJYY");
    link.setAttribute("href", url);
    head.appendChild(link);
};

It is called like this
instead of the way it was done before 

I also changed all references to version 3.1.1 to STABLE
I did create the Maps API key but got a message that the Maps API was not enabled in Google Cloud Platform. Enabling that was the final step needed to make it work.

George Adams


--
You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simile-widget...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simile-widgets/683cf408-c4de-4f83-9eb9-932f1e46a53d%40googlegroups.com.

dhinostroza

unread,
Dec 27, 2019, 4:28:44 PM12/27/19
to SIMILE Widgets
Cool! I didn't think this was even possible using Google Sites.
Best,
Daniel

On Tuesday, December 24, 2019 at 12:57:41 PM UTC-5, George Adams wrote:

George Adams

unread,
Dec 28, 2019, 8:45:53 AM12/28/19
to simile-...@googlegroups.com
This page has been working on Google Sites since April 2011. It also uses a Google Spreadsheet for the data.
If it stops working in the future I will probably need the help from this group again as it has been so long since I got this working.

George Adams


--
You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simile-widget...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages