In order for Geolocation data to be generated within listings and to have listings rendered on the map, the API key must be properly set up as per our docs here: Creating a Google Maps API Key.
In cases where you have not properly set up your API key, then you are likely to encounter errors.
Some of the common issues are:
- Why isn’t the Geolocation data being generated within my listings?
- Why isn’t my map displaying any listings?
Within this doc, we will use the Google Maps API Key Testing Tool to identify these errors, of which should help in resolving the highlighted issues. You will therefore need to:
First download and install the plugin
Navigate to your WordPress dashboard and select the GMaps Key Test
Fill in your API key within the API key section and specify any location within the location section such as “London”
Click on the “Test API Key” button
Possible Error Results
- This API project is not authorized to use this API
This would mean that you have not enabled all the four API services within your API key:
- Geocoding API
- Geolocation API
- Places API
You will therefore need to enable the API services within your Google developer console dashboard
- The provided API key is invalid
This would mean that the API key that you are using is incorrect. You will therefore need to counter-check on the key that is within your console dashboard, credentials section and copy it over again to your site.
- You must enable Billing on the Google Cloud Project
This means that you have not enabled billing within your API project. You must enable billing in order to use the API key. To do so, you will need to:
- Navigate to the API console
- From the projects list, select your project
- Within the popup, select “Create Billing account”
- Select your location, fill out the form, and click Submit and enable billing
After you enable billing, any requests to billable APIs beyond their free courtesy usage limits are billed, subject to the billing terms of each API.
- API key with referrer restrictions cannot be used with this API
This means that you have enabled referrer restrictions within your API key. You will need to set the referrer restrictions to “none”.
Once you are done with any of these steps above, please ensure that you re-update the location values within the listings by carrying out the steps below:
1. Remove the location value within the listing
2. Update the listing
3. Fill in the location value once again within the listing and update it.Ensure that you carry this out for all your listings.