Admins and Account owners can connect their OpenForms account with Google Maps, so that Authors can configure location fields to display Google Maps.
Once configured, respondents can see and interact with Google Maps, but you first need to set up an account with Google Maps, generate an API key, and then connect with Google Maps.
Get Started with Google Maps Platform
You will need a Google Account; your organization may already have one if you use Google Analytics. If you need help using Google Maps, please consult the Google Maps Platform Documentation.
If this is your first time using Google Cloud Console, you must add a credit card to your billing account. Your card will be charged if your API calls exceed the usage cap. Google's pricing guide can provide some more information on usage costs.
- Go to the Google Maps Platform and sign in using your Google account details.
- If you have never used Google Maps before, you can select Get started > Maps, Routes, and Places > Continue.
- Select an existing project or select Create Project. You will need a project to set up an API key.
- Select Next and you will need to link your billing account.
Set Up an API Key
To generate and use the API key, you will need to:
- If you selected Maps, Routes, and Places earlier, then your APIs are already enabled, and you can skip this step. Otherwise, go to APIs & Services > Library and search for and Enable the following three APIs and services:
- Google Places API (New) Web Service
- Google Maps Javascript API
- Google Maps Geocoding API
- Once enabled, go to APIs & Services > Credentials in the navigation menu.
- Go to the Create credentials drop-down menu and select API key.
- Select the Copy to clipboard icon to copy it and paste it into a notepad.
- Go back to APIs & Services > Credentials and select the API key you created to go to the Edit API key screen.
- Under Application restrictions, select Websites.
- Select Add under Website restrictions and paste *.openforms.com/* into the Add website field.
- Select Done and then Save.
Connect OpenForms and Google Maps
When you have your API key and have enabled the correct APIs:
- In OpenForms, go to Integrations > Connectors > Form add-ons > Google Maps.
- Select Add.
- Paste your copied API key into the Enter the API key field.
- Select Save changes.
With your API key working correctly and the connector enabled, form authors can start using Google Maps as the map provider when using the location field.
To test this:
- Go to a form and add a location field.
- Open the Location Field Settings and select Google Maps from the Map provider drop-down menu.
- Select Save and preview and confirm that the map loads without any issues and that you can use the map to search for locations.
When OpenForms Contacts Google Maps
Excessive API calls can incur costs. OpenForms contacts the Google Maps APIs in different ways as respondents use the location field:
- Google Places API (New) Web Service is called when respondents enter text in a form’s location field and pause for at least half a second to display predictive results.
- Google Maps Javascript API is called when respondents:
- Click on a map in the location field to mark a location.
- Select a predictive text option from the location field.
- Select the Use my location option in the location field.
- Google Maps Geocoding API is called when a respondent opens or loads a saved form containing a location field, and if a location field is shown as a result of a display logic scenario. Please note, the API is not called as a respondent navigates between sections.