This question is answered.


Permlink Replies: 19 - Pages: 2 [ 1 2 | Next ] - Last Post: 27-Feb-2019 12:00 Last Post By: deOldphart
deOldphart

Posts: 12
Registered: 19-Nov-2013
Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 13:06
 
  Click to reply to this thread Reply
I am trying to use Google maps in the Fancybox skin but I am getting the error "Geocoder failed due to: REQUEST_DENIED" that is associated with not having an API key. However, I do have an API key from Google and that key works perfectly well in the Gromit skin, so I have no idea what the problem really is. Any help would be appreciated. Thanks
AndreWolff

Posts: 1,715
Registered: 14-Dec-2007
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 13:26   in response to: deOldphart in response to: deOldphart
 
  Click to reply to this thread Reply
Is that key restricted to an URL?

Make another key and try it again!
deOldphart

Posts: 12
Registered: 19-Nov-2013
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 14:40   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Thanks for the quick response.

No, the API key is not restricted in any way.

I generated another API key, also unrestricted, and it also caused the same error.

As a test, using the same album, I simply changed the skin to Gromit, placed the newly generated API key, and did a "Make album/make changes". The new Gromit based skin brought up the Google maps with no problem.
AndreWolff

Posts: 1,715
Registered: 14-Dec-2007
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 14:49   in response to: deOldphart in response to: deOldphart
 
  Click to reply to this thread Reply
Please give a link to the FancyBox album and attach the project file.

Edited by: AndreWolff on 25-Feb-2019 14:55
deOldphart

Posts: 12
Registered: 19-Nov-2013
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 15:26   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
http://www.rsbroughton.co.uk/Iran trip album1/

Presumably you mean the .jap file, attached.
AndreWolff

Posts: 1,715
Registered: 14-Dec-2007
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 17:35   in response to: deOldphart in response to: deOldphart
 
  Click to reply to this thread Reply
deOldphart wrote:
http://www.rsbroughton.co.uk/Iran trip album1/

Presumably you mean the .jap file, attached.

Thr Coogle Chrome console shows 2 errors in your album:

Failed to load resource: the server responded with a status of 404 (Not Found)
js?key=keyRemovedbyAW Geocoding Service:
This API project is not authorized to use this API.
For more information on authentication and Google Maps JavaScript API services please see:
https://developers.google.com/maps/documentation/javascript/get-api-key

I made a simple test album with my own key which works OK: https://andrewolff.jalbum.net/Vecht_SaharaN_FB/

However if I use your key in this test album, I get the same error message as you.

Your key contains characters like - and _ which I do not see in my key.
Apparently the Gromit skin encodes these characters I think.

This will cost me more time to investigate!
deOldphart

Posts: 12
Registered: 19-Nov-2013
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 19:09   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Well, thanks for looking in to it.

I can confirm that it is not a matter of the odd characters - _ . I regenerated keys until I got one without either character, but that produced the same error.

I suspect my key would not work with your project in any case because it is attached to my projects.

The same album skinned with Gromit and using my latest regenerated key works just fine with Google maps and generates no errors in the console.
http://www.rsbroughton.co.uk/Iran%20trip%20album2/

I was hoping to use FancyBox for some new albums that need maps because I think it is a more elegant skin, but I guess I'll have to stick with Gromit.
jGromit

Posts: 7,270
Registered: 31-Jan-2006
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 19:24   in response to: deOldphart in response to: deOldphart
Helpful
  Click to reply to this thread Reply
If you want maps, but with a more modern appearance than Gromit, try Saturn, which has a Gromit-like thumbnail page, but with a lightbox instead of separate slide pages. Or for a more contemporary appearance, try Neptune, which has a justified gallery of thumbnails (the next release will offer fixed-shape thumbnails, as well), and the same lightbox as Saturn.

ETA: Samples: https://jgromit.com/

There's no "Neptune with maps" example, but the lightbox and map display is the same as the "Saturn with maps" example.
AndreWolff

Posts: 1,715
Registered: 14-Dec-2007
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 20:12   in response to: deOldphart in response to: deOldphart
 
  Click to reply to this thread Reply
deOldphart wrote:
I suspect my key would not work with your project in any case because it is attached to my projects.
Did you try it too with a regeneratief key which was not attached to your project?

I can’t yet explain why it works with my key and not with your key, I have to find the difference!
deOldphart

Posts: 12
Registered: 19-Nov-2013
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 21:18   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Thanks, Gromit. I have just looked at both Saturn and Neptune and they are quite nice, but they lack one feature that FancyBox has, which is the ability to go into full screen mode. I like the full screen option for my slide shows of travels. Nonetheless, I see that you offer some good alternatives to your eponymous skin.
deOldphart

Posts: 12
Registered: 19-Nov-2013
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 21:33   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
My last set of tests have been with the newly generated API key that does not have - or _ in the key. FancyBox still gets the error with that key. I did not forward that to you, but I can if you think it would help, however I don't think that is the problem.

Thanks to Gromit's suggestion I have just completed some tests, simply by changing the skin, setting the map key (and related bits) and doing a "Make album/changes only" and looking at the results with Preview.

Skins Gromit, Saturn, and Neptune all work just fine with the API key and bring up Google maps with no problem

Skins FancyBox and PhotoSwipe generate the Google map error.

The specific error that comes back is Geocoding Service: This API project is not authorized to use this API. which suggests that the issue has to do with authorization, not whether the key itself is valid. In any case there seems to be something different about how you and Gromit handle the interaction with Google in your code.
AndreWolff

Posts: 1,715
Registered: 14-Dec-2007
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 22:44   in response to: deOldphart in response to: deOldphart
 
  Click to reply to this thread Reply
Thanks for your tests!

I had another look at your http://www.rsbroughton.co.uk/Iran trip album1/ album:

If I open your album in the Google Chrome debugger (F12) I see this error if I open the console:
JavaScript API error: ExpiredKeyMapError
https://developers.google.com/maps/documentation/javascript/error-messages#expired-key-map-error

and if you open that link you see:

ExpiredKeyMapError Error
The API key included in the script element that loads the API has expired.
You may need to generate a new API key in the Google Cloud Platform Console.

Notice that I did not yet click the location button, only the key is checked.

Do you restrict your key in time?

In the meantime I tested my test album with two other keys, one unrestricted and one restricted to my domain: both keys were working correctly!

So I am still confused!

Edited by: AndreWolff on 25-Feb-2019 23:01
deOldphart

Posts: 12
Registered: 19-Nov-2013
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 23:35   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Sorry, I think I had replaced that album on my website a couple of times in testing and that had introduced some additional (spurious) errors. The following should bring up a clean version of the FancyBox site with just the original error.

http://www.rsbroughton.co.uk/Iran trip album1/

Given the behaviour so far, I suspect that all your testing with your keys will result in no problem with the maps. The problem will show up when someone else with keys generated for a different Google Project uses your skin. What we need now is a bit of help. Perhaps Gromit could run a test or two of your skins on albums known to be good with his skins? My bet is that he will have the problem as well.
jGromit

Posts: 7,270
Registered: 31-Jan-2006
Re: Fancybox: Unable to get maps working.
Posted: 25-Feb-2019 23:51   in response to: deOldphart in response to: deOldphart
Correct
  Click to reply to this thread Reply
Attachment step1.png (29.6 KB)
Attachment step2.png (80.9 KB)
Attachment step3.png (32.6 KB)
Attachment step4.png (21.9 KB)
As much as I've enjoyed this thrashing about, I guess it's time to confess. When I saw your original post, and did about 60 seconds of Googling, I was pretty sure I knew what the problem is. I haven't done a thorough test, but I'm about 98% sure my first hunch was correct.

Now, what's it worth to both of you to find out how to fix this?

OK, I'll take pity on you. In short, Fancybox is calling upon one of the Google maps API's that's "beyond" the basic functionality. The tipoff is that the error message refers to "geocode," which is a separate service. On my old API keys, it's enabled by default, so the Fancybox maps work. But maybe with a newer key, that's apparently not the case. Just be aware that it's billed at a different rate.

Head for your Google maps API console, then see the series of screenshots attached, in order. After the last step, look for an "enable" button somewhere.
deOldphart

Posts: 12
Registered: 19-Nov-2013
Re: Fancybox: Unable to get maps working.
Posted: 26-Feb-2019 00:13   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Thanks for your belated assistance, Gromit. That worked, and the test site is now bringing up the Google Maps as expected.

I'm afraid I know next to nothing about Google APIs and simply followed the instructions I found, I believe, in one of the forum posts here. I suspect the instructions for using Google Map APIs are going to get a bit more complicated.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums