I am trying to: set up a parametric search for business CPTs to determine which are closest to the users current or a user defined location. I have followed a few posts and have been able to use the location to set the longitude and latitude into two respective post fields.
The tricky part from here is to find the distance from the location and also determine the location.
Can someone help me do this and also it seems a lot of people are requesting this feature - is it possible to add this to Maps?
Hello. Thank you for contacting the Toolset support.
There is no such way you can calculate the distance for now but this feature is already reported and we have an internal ticket for that. I've added your voice to our internal ticket and this feature is currently under assessment.
Please note that we do not have any ETA. This completely depends on predefined priorities and development cycle we have.
But thank you for raising your voice for this feature that will help our developers to prioritize the feature request.
My next question is how to make this work myself within parametric search.
I can easily calculate this distance between to sets of coordinates, each taken from an address.
I can store the coords for each post in a custom field and I can get the users location and set that as the second set of coordinates to calculate the distance.
The trick is in getting that process to happen within the parametric search function. What would it take to make that happen in there?
I could create a plugin that will display the distance using a shortcode but how do I make that work in the search function?