Hi!
I have a search feature on my website that allows people to search for healthcare professionals by location. I have 2 search boxes, one for “speciality” and the other for “location” that combine the entries to filter a database.
What I want to do now is filter the results based on how close the healthcare professionals are to the person searching. So for example If I need physiotherapy in London and there are no physiotherapists in London exactly, but there is one lets say 100km away, it will list that person and specify how far they are from the person searching. Is this possible?
Massively appreciate any help! Thanks!
1 Like
If you want to use code to get the current users location, then you will have to use.
https://www.wix.com/corvid/reference/wix-window.html#getCurrentGeolocation
Otherwise, you might be better off just giving the user an option of distance willing to travel for example, so that they can choose how far or how close they want to search for healthcare professionals.
Ah that’s a very good idea. To make this work though how would the code know the distance that a service would be within a given distance of the user? Wouldn’t the code or database need to be linked to something like Google maps?
Yes, good idea you could use Google Maps.
https://support.wix.com/en/article/adding-and-setting-up-google-maps
https://www.wix.com/corvid/forum/wix-tips-and-updates/example-multiple-markers-google-maps
https://www.wix.com/corvid/forum/wix-tips-and-updates/example-using-the-places-api-from-google-maps-services
You would have to figure out how to use their location if they allowed you to use it to begin with, or use a set point from where they live themselves, like Google Maps do themselves with middle of town for example, to give a distance of a set amount of miles/km away that they wish to travel.
You could look at using the Places API to get their location and work from there with using locations of the healthcare professionals in that surrounding area.
It all depends on how much work you want to do for it etc, you can always use Wix Arena to hire a Wix Expert to do it all for you.
Otherwise as previously, you could always use a set dataset collection of all existing healthcare professionals with their locations etc and then query that dataset with the users own location to see if there are any within that specific area or a set distance away from them.
@buxtonfm5 Please add your own issue into a new post instead of bumping up an old post. Explain what you are trying to do, what works, and what doesn’t. Also, add any code in a code block as stated in the Forum Guidelines .
This is an old post and is being closed.