Topic: Google maps API not being set


On my site Indicia pages using google map layers are not being rendered properly any more. I know google changed their rules a while ago, and I do have billing enabled etc but the Google API Key which I have set in iForm > Settings is not being passed to the map pages. Is there somewhere else I need to set this now? I have tried hard-coding it in helper_config.hp but that didn't make a difference.

Do I need to add a script somewhere and if so, where?

This kind of thing?
<script async defer src="https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=initMap"></script>



Re: Google maps API not being set

It sounds like you are doing all the right things and we have it working at https://www.brc.ac.uk/irecord/enter-casual-record

Our /admin/config/iform/settings page has two spaces for the key labelled as follows:

Google API Key (The Google API provides the Places API text search, another option to lookup place names when you use the place search control. It references a global database of places and returns the list of possibilities with their spatial references to Indicia. To obtain your own API key for the Google API, please visit the Google APIs Console.)

Google Maps API Key (The Google Maps API key is required to allow use of Google Maps layers but can be left blank if you do not intend to use Google maps. To obtain your own API key for the Google Maps API, please visit the Google APIs documentation.)

We have them both set to the same value. Is yours similar?

Jim Bacon


Re: Google maps API not being set

Are you running a recent version of the iform module and client helper code? It has been updated to allow for a separate Maps API key for Google which is needed for the newer release of the Google Maps API.

John van Breda
Biodiverse IT


Re: Google maps API not being set


Thanks for the replies.

No, my iform settings page only has only space for the Google API Key key (plus GeoPlanet and Bing) so I suppose that means I need to upgrade.

Please point me to the recommended place to get the updated iform module from.

Thanks, Alice


Re: Google maps API not being set

I would generally go to https://github.com/Indicia-Team/drupal- … m/releases although I also check https://github.com/Indicia-Team/drupal- … iform/tags to see if there is anything more recent worth having. The advantage of the release rather than the tag is that the zip file includes compatible client_helpers and media files.

Remember that upgrading is not as clean as normal Drupal modules. You need to preserve config files and folder permissions within the module. I usually do this by copying the new module over the old module. (The other technique that works well is to use Git to pull in changes.)

Jim Bacon