Using Google (GeoCoding & Map) APIs with Woffice
This is most likely the trickiest point in the Woffice setup. We will try to explain everything here to make sure it is as clear as possible.
What APIs are used?
First, let see what API is needed and for what purposes, in Woffice we use two Google APIs for the maps. Any API call requires an authentication so you must get a key.
- Create all the maps (members map, option maps, directory maps, events map...).
- Mainly all the maps rendered in the frontend and client side.
|- It turns addresses into GPS coordinates using Google API.|
- Members map only
- It is not used within the map
|Key option location||Appearance > Theme Settings > General Options > GOOGLE MAP API KEY||Unyson > Woffice Members Map > Settings >|
|Requirement||Any other plugin using the same API can be a conflict cause. They all have an option to deactivate the the API call from their setting. Use the Theme one.||No conflict here is possible.|
|When API calls are made||Whenever a map is created.||Whenever you load the extension's settings. |
And when any user saves his profile, we re-create all the locations.
How to get a key for each API?
- Reach the API Google Dashboard: https://console.developers.google.com/apis/
- Create a new Project (the name does not matter):
Find the 2 APIs that must be enabled from the APIs library:
Enable each API:
Get a key:
When clicking this button, select "API key", you'll now find your key:
- The same key can now be used for the 2 APIs.
- You can create several keys.
- You can restrain access to your key but for any issue, that might be harder to troubleshoot.
There are several issues that may occur due to your plugins, setup, settings. Yet, it works most of the time in one shot! :) If you still have some issues please have a look below.
Google MAP Geocoding API:
- Open a new tab in your favorite browser and reach: https://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false&key=KEY. Do not forget to replace KEY at the end with your Geocoding API key. You can find details on them on the official documentation.
if you still have issue of map not displaying than please check if you are using pro event calendar plugin or not .
if you are using that , go to WP-admin-panel > event calendar > settings >
and Check "Exclude Google Maps JS file?" option and save changes .
Member Map not showing pins :
after that edit 2-3 user's profile and in location field , fill location , for testing , we suggest to use only country name for testing and than you may test .