0

I need to find the closest location from a user's address to the list of other users' addresses which is selected from the database. How can I do that?

user's address: Via dei Fori Imperiali 00186 Roma Italia

list of addresses: 1)Via Alessandrina 00186 Roma Italia

2)Via XXXXXXX XXXXX Milano Italia

RETURN 1, which is the closest address to user's address

1 Answers1

0

Unless you have a record of latitude & longitude equivalents for all the postcodes in the country(ies) you will be dealing with, you'll have to use the Google Maps API.

Have a look here: https://developers.google.com/maps/documentation/distancematrix/

Example URL and output here: Calculate Distance Between Two Postcodes in php

Community
  • 1
  • 1
LS11
  • 261
  • 1
  • 6