1

Topic: Google Maps API

Hi all
Today, it seems that the way the Google Maps API serves its JavaScript changed. The result of this is that maps with the Google Streets layer as the first loaded layer will not show the base layer until you pan or zoom the map.
The fix is to force loading of the v3 API version. The update is described at https://code.google.com/p/indicia/source/detail?r=9303.
Regards
John

John van Breda
Biodiverse IT

2

Re: Google Maps API

Hi John, Wondered what was going on there. Your link is throwing 404 has the page moved?

Natural History & Biodiversity Data Enthusiast

3

Re: Google Maps API

The link did that for me, but it has a full stop at the end that needs removed.

Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

4

Re: Google Maps API

Cheers Fiona, missed that.

Natural History & Biodiversity Data Enthusiast

5

Re: Google Maps API

Should have remembered that the forum breaks URLs if at the end of a sentence! Now edited.

John van Breda
Biodiverse IT

6 (edited by Jim Bacon 21-05-2015 10:51:28)

Re: Google Maps API

I looked in to the versioning at Google and found https://developers.google.com/maps/docu … Versioning.

It says "If you do not explicitly specify a version, you will receive the experimental version by default." They describe this as "living on the edge"!

Using v=3 gets you the latest released version so it is still subject to quarterly change.

I have raised an issue with Google, https://code.google.com/p/gmaps-api-iss … il?id=8092. Since the experimental version becomes the next release, if the issue is not addressed, the maps will fail again when the next upgrade happens. That could then be circumvented by specifying a minor version explicitly, e.g. v=3.20, but that would then stop us getting future bug fixes and upgrades.

I also checked out our version of OpenLayers which is 2.13.1. This is the stable and probably final version 2 release. It is 2 years old and the latest release is version 3.5.0. There is no migration path from v2 to v3 so a code rewrite would be needed to upgrade.

Jim Bacon

7

Re: Google Maps API

Further to this, Google have closed the issue I raised, declaring it a bug in OpenLayers.
Google also requested that I raise an issue with OpenLayers which I did.
See https://github.com/openlayers/openlayers/issues/1450
There are some workarounds listed there.

Because of Google's 3 month release cycle, the current fix will stop working in August.
Specifying v3.20 of the API will keep things going until November.
Putting a workaround in place before things break would be nice if anyone has a spare moment!

Jim Bacon.

8

Re: Google Maps API

I keep being re-directed to: "https://github.com/indicia-team/indicia-code" so I can't see the update process, or any of the documentation.

Dave Slade
Senior IT & Records Officer,
15 Talbot Road, Talbot Green, Pontyclun, CF72 8AD
www.sewbrec.org.uk, www.sewbrecord.org.uk

9

Re: Google Maps API

We've been compelled to move the code from Google to Github as Google are shutting down their code repository. I should write a post in this forum to explain but was waiting for the move to be completed.

The documentation can be found at http://indicia-docs.readthedocs.org/en/latest/

Jim Bacon

10

Re: Google Maps API

Thanks Jim. Can you point me in the direction of the Google API fix?

Dave Slade
Senior IT & Records Officer,
15 Talbot Road, Talbot Green, Pontyclun, CF72 8AD
www.sewbrec.org.uk, www.sewbrecord.org.uk

11

Re: Google Maps API

It is a tiny change in iform/client_helpers/helper_base.php.
Does the attached screenshot make it clear?
The right-hand pane shows the change in r9303 relative to the previous version appearing in the left-hand pane.

Jim Bacon

Post's attachments

r9303.jpg 325.72 kb, 1 downloads since 2015-07-20 

You don't have the permssions to download the attachments of this post.

12

Re: Google Maps API

Many thanks Jim, that's got it!

Dave Slade
Senior IT & Records Officer,
15 Talbot Road, Talbot Green, Pontyclun, CF72 8AD
www.sewbrec.org.uk, www.sewbrecord.org.uk

13

Re: Google Maps API

Has a permanent fix been implemented?

I had to update the googlemaps entry in helper_base.php to ?v=3.20, as suggested in the 16-07-2015 post would be necessary after August.

Chris Dee
Garganey Consulting

14

Re: Google Maps API

I'm working on it at present. Will let you know my conclusions.
Jim Bacon.

15

Re: Google Maps API

We have committed the following fixes which all relate to the changes with Google Maps.
https://github.com/Indicia-Team/client_ … 2a96e4adf0
https://github.com/Indicia-Team/client_ … ee012ffde5
https://github.com/Indicia-Team/media/c … 99cd472794
https://github.com/Indicia-Team/media/c … da0792b931

There are map functions in Indicia that have not been tested and may not work correctly. Please let us know if you encounter any problems.

See https://github.com/openlayers/openlayers/issues/1450 for some additional discussion if interested.

Jim Bacon.

16

Re: Google Maps API

The patch to OpenLayers has been updated.
See https://github.com/Indicia-Team/media/c … 7d5eb28cae

There were problems with the previous patch when features were added to a vector layer while Google Maps were loading, resulting in duplicate features appearing.

This is only relevant to a limited number of users, possibly none outside of BRC.

Jim Bacon.

17

Re: Google Maps API

The ?v=3.20 hack has stopped working now - if Google Physical or Google Streets is selected in the form definition, the exposed map is blank until I change the base layer.

Am I expected to install these patches manually or is there an updated package? The "Indicia Forms for Drupal 7" download at http://www.indicia.org.uk/downloads doesn't seem to include these changes, so I'm not sure what 'committed' means.

Thanks, Chris

Chris Dee
Garganey Consulting

18

Re: Google Maps API

Hi Chris,

By committed I mean that the bug fix is in the Github code repository.

You can download the files you need from https://github.com/Indicia-Team/media/tree/develop/js and install them manually.

Jim Bacon.

19

Re: Google Maps API

I should add that, to download a file you can click the file you want, (all the OpenLayers files for consistency but probably only OpenLayers.js in practise), choose to view the raw file and then Save As from your browser.

Jim Bacon.

20

Re: Google Maps API

Updating the OpenLayers*.js files worked.

Thanks, Chris

Chris Dee
Garganey Consulting