Skip Navigation

[Resolved] Calculate distance by Map API and use in view.

This thread is resolved. Here is a description of the problem and solution.

Problem:
Calculate distance by Map API and use in view.

Solution:
Youo can use the Maps shortcode: [toolset-maps-distance-value] to calculate the distance.

Relevant Documentation:
https://toolset.com/documentation/user-guides/maps-shortcodes/#toolset-maps-distance-value

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Himanshu Agarwal 6 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1175131

We Need a form with fields below

Start location -> User input field that show places from google map.

End location -> User input field that show places from google map.

On submit both field's value post to the another page.

On another page (where we are listing custom post type "Bike") we get :-

Start location
End location

And distance between Start location and End location.

In this page we list the custom post type (Bike) by multiply distance to value of "Per KM" (a custom field).

Please let me know how to achieve this in toolset?

#1175136

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - what if you try to use the Maps shortcode: [toolset-maps-distance-value]

For example:

[toolset-maps-distance-value postmeta='wpcf-start-location' location='{[types field='end-location' format='FIELD_LATITUDE,FIELD_LONGITUDE'][/types]}']

More info:
=> https://toolset.com/documentation/user-guides/maps-shortcodes/#toolset-maps-distance-value

#1175334

Thank you for reply.

Please help me, how to make a form to take location from user end?

I mean a form that show fields, Start location and End location with google api and user fill the location (only places).

After submit calculate distance between filled locations (places), and show that distance and location to a View in a template (toolset).

Please let me know, how to make this process step by step?

New threads created by Minesh and linked to this one are listed below:

https://toolset.com/forums/topic/split-calculate-distance-by-map-api-and-use-in-view-how-to-createa-form/

#1175363

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please mark resolve this ticket as we will continue with a fresh new ticket with your every new question.

#1175368

My issue is resolved now. Thank you!