With Mapfolk Pro, a map can show Google Maps instead of OpenStreetMap, using your own API key and a Map ID. Mapfolk needs both: without a key or Map ID, the map keeps running on OpenStreetMap. Google charges for use above its free quota.
In the Google Cloud Console
- Sign in to the Google Cloud Console and open a project with billing enabled. Google requires a billing account for keys used in production.
- Open the page of the Maps JavaScript API and click Enable. If it says Manage, the API is already enabled.
- Go to Google Maps Platform, Keys & Credentials, and click Create credentials, API key. Under Select API restrictions, keep only Maps JavaScript API, then click Create.
- Restrict the key to your website: open the key, choose Set an application restriction under Key restrictions, select Websites and enter your address with scheme, such as
https://www.your-domain.com. Withhttps://*.your-domain.comall subdomains count. Click Save. - Open the Map Management page and click Create map ID. Enter a Name, set Map type to JavaScript, choose Vector and click Save. Google then shows the new Map ID.
In Mapfolk
- Open Mapfolk, Settings, tab Services. Under Map service, choose Google Maps as the Service.
- Paste the key into Key for Google Maps and the ID into Map ID (required).
- Click Test. Mapfolk loads a small preview with this key and Map ID. “The key works” means you are done. If Google refuses the key, it is invalid, restricted to other addresses, or the Maps JavaScript API is not enabled for it.
- Click Save services. Without a Map ID, Mapfolk does not save the switch to Google.
When a map switches to Google, Mapfolk turns on Load map only after consent in the tab Features, because Google receives visitor data as soon as the map loads. How Mapfolk works with the cookie banner is covered in Map only after consent, and the blog explains why Google Maps needs consent.
Good to know
- The key and the Map ID apply to every map on the site that uses Google Maps.
- With Google Maps, the style of the Map ID applies; the map styles in the tab Display only affect OpenStreetMap. You change the look of the map in the Cloud Console, where styles are linked to Map IDs.
- Clustering, radius search and filters work the same with Google Maps as with OpenStreetMap.
- Geocoding stays with the service set under Service for geocoding. Google is used only to display the map.