Google Maps
Google Maps can draw the Map module with its price pins and the Map section of each property page instead of OpenStreetMap, the default. It needs your own Google Maps API key.
Where maps appear and how they behave is in Site modules and Property page. A property appears on a map only when it has a Latitude and Longitude, set on the Address tab of the property editor.
Get a key
- In the Google Cloud console, create or choose a project and set up billing (Google requires it, even within the free usage).
- Enable the Maps JavaScript API.
- Create an API key. Under its restrictions, set Application restrictions to websites and add your site's address, and limit API restrictions to the Maps JavaScript API.
The key is sent to visitors' browsers, which is normal for a Maps JavaScript key: the website restriction is what stops others from using it.
Choosing Google Maps
Open Configure > Settings > Search and map:
| Setting | Effect |
|---|---|
| Map | Set to Google Maps (the default is OpenStreetMap (no key needed)) |
| Google Maps API key | A browser key with the Maps JavaScript API, restricted to your site's address. Visitors can see it in the page |
| Map centre latitude, Map centre longitude, Map zoom | Where maps start when no property is shown. The defaults centre on the United Kingdom |
Paste the key, set Map to Google Maps and save.
Each Map module can override the provider with its own Map provider: As in Settings > Search and map, OpenStreetMap or Google Maps. Google Maps there still needs the key in Settings.
Fallback to OpenStreetMap
With Google Maps chosen but no key, the site shows OpenStreetMap and the settings page warns you. If Google Maps fails to load in the visitor's browser, the map falls back to OpenStreetMap too.
How it works
The visitor's browser loads the map from maps.googleapis.com; your server does not call it. See Firewall and outgoing connections.
Group nearby pins in the Map module works with Google Maps as with OpenStreetMap.
Directions
Get directions on a property page opens Google Maps' directions to the property, whichever map provider you chose. On phones it opens the maps app. The cleaner app's Directions opens Apple Maps on iPhones and Google Maps elsewhere. Neither needs your API key.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Google Maps is chosen but the site shows OpenStreetMap | No key under Configure > Settings > Search and map, or Google refused to load the map. See the browser console for Google's message |
| Google shows "This page can't load Google Maps correctly" | Billing is not set up, the Maps JavaScript API is not enabled, or the key is restricted to another address |
| A property is missing from the map | It has no latitude and longitude, or it does not match the current filter |
| The map starts in the wrong country | Set Map centre latitude, Map centre longitude and Map zoom |