Can you tell me what Google API can calculate distance for my current location with many places in my database?
For example, if I have many hospitals on my the map, how can I know the nearest place compared with my current location?
Can you tell me what Google API can calculate distance for my current location with many places in my database?
For example, if I have many hospitals on my the map, how can I know the nearest place compared with my current location?
If you want to get straight line distance then you can get it from
loc1.distance(from: loc2)
But if you want to get on road distance then you can get it from google API.
Reference:
https://developers.google.com/maps/documentation/distance-matrix/intro
Here key is API Key that you have to generate, and origins is your origin latitude and longitude and destinations is series of destination.
You can easily click above api to see the results.