Hello @3vance
Yes of course. Please, visit the following link that includes the description of the operations available in the “Distance Module”:
https://cff.dwbooster.com/documentation#distance-module
https://cff.dwbooster.com/blog/2018/09/25/misunderstood-operations/#distance
Best regards.
Thread Starter
3vance
(@3vance)
Thanks for the response. I have looked at the documentation links you provided above. It was a little confusing. Is there a video tutorial showing step by step how to use Distance module in a calculated fields form?
Hello @3vance
The use of this operation is very simple. I’ll try to describe it with a hypothetical example: assuming there is two text fields in the form for entering the addresses: fieldname1 and fieldname2, and you want get the distance in miles between them, you simply should insert a calculated field in the form with the following code as its equation:
DISTANCE(fieldname1, fieldname2, 'mi', 'DRIVING')
if you want get the distance in kilometers:
DISTANCE(fieldname1, fieldname2, 'km', 'DRIVING')
As this operation uses the Google APIs to get the distance, it requires that you generate a Google API Key (https://console.developers.google.com/apis/dashboard) to be used in your website domain, and you pass it to the form.
So, if the id of your form is 123, the form’s shortcode would be:
[CP_CALCULATED_FIELDS id="123" google_api_key="your api key here"]
replacing the text: your api key here
with the API Key you have generated from the Google Developer Console.
Best regards.
Thread Starter
3vance
(@3vance)
I want to create a real-time quotation form for a borehole drilling business.
The drilling business location (Point A) will be the default starting point on the map.
A website visitor will get a quotation by adding their location (Point B) by dragging Point B marker on the map or typing their location (Point B) inside a text field.
Then the distance from the above will be automatically factored in calculations by the form when adding the total cost.
Is this possible with Developer version of this plugin?
Hello @3vance
You are merging different questions here, the DISTANCE operation that estimate the distance between two address does not requires a map, simply two directions, and if one of direction is fixed (not entered by the user), you should enter it directly in the equation:
DISTANCE("the address here", fieldname2, 'mi', 'DRIVING')
The plugin does not includes a map in the forms, however, you can extend your forms as you want, and you can insert a map by yourself using some of code.
Another alternative would be the use of the “Google Places add-on” or the “Autocomplete Places add-on”, both distributed with the Platinum version of the plugin. They transform the input fields for the addresses into autocomplete fields, that suggest to the users possibles addresses in the typing process.
Best regards.