Garmaine Staff asked 2 years ago

I've created an website which stores the vendor location (latitude, longitude) and i use google maps API to store their location. when a user search for a specific item, the search results shows a list of vendors. All i want is to get the nearest vendors that are close to the user that all. I'm also showing vendor and user's location on the map but i can't figure out how to get the closest one only. I'd be really thankful if anyone could help me out.

I've added the image just so you can get an idea what i am trying to do here.

enter image description here