Doc > Distance calculations

In Documentation by loopus

To use distance calculations in your form, you first need to fill the “Google Maps browser key” with a valid key. To get a browser javascript API key for Google Maps, please follow this link :

Here are the services to activate from the Google API console :

  • Distance Matrix API
  • Maps JavaScript API
  • Places API
  • Geocoding API

Click the “Add a distance” button above the price calculation field or the quantity calculation field to open the distance calculation panel :

Simply select the corresponding fields (textfields and selects) of your form on each dropdown for departure and arrival addresses. If a field doesn’t exist in your form, you can simply leave the dropdown value to “Nothing”.
The plugin uses the “Type of information” option of text and select fields of the form to detect the available address fields.
Then choose if the result must be generated in km or miles and click the “Insert” button to finish.

You can use the “Distances calculation mode” option in the “General” settings tab of your form to choose if the distances returned by Google Maps API must be calculated as a “route” or “direct” travel.
If the distance can’t be calculated by Google Maps, an error message will be displayed (you can edit it from the “Texts” tab) and the next step button will be hidden, so that the user can’t continue the form without correcting the filled fields.