Google Directions
On a location page, visitors can type their own address and get a driving route to the location. JoomMap uses the directions service of the Google Maps JavaScript API for this, with your Google Maps API key.
How it works
- The visitor types an address in the field below the map and clicks Get Directions.
- Google geocodes the address. Search Region from the Map Search tab is added to it.
- Google calculates a driving route from there to the location.
- JoomMap draws the route on the map and lists the steps below it.
The route is always for driving. Walking, cycling and public transport are not offered.
Set up
- In the Google Cloud Console, open the project of your Maps API key.
- Under APIs & Services > Library, enable the directions API that Google lists for the Maps JavaScript API directions service, and the Geocoding API.
- If your key has API restrictions, add both APIs to them.
- In JoomMap, set Show Get Directions? to Yes on the Locations tab of the options. It is on by default. You can turn it off for single locations in their Advanced Parameters.
Google has changed its directions products several times. If your Cloud project does not let you enable the directions API, directions cannot work on your site. Set Show Get Directions? to No so visitors do not see a form that fails.
When it fails
A message "Google was unable to calculate driving directions to this location. Geolocation result:" followed by a code means Google refused or found no route. REQUEST_DENIED points to the key or a disabled API, ZERO_RESULTS to an address Google could not route from, for example across the sea.
Directions are billed by Google per request.