Google provides APIs for 1. Distance Matrix and 2. Direction service
I tried to search about difference between 1 and 2
My task is \"When user
According to Google Maps API picker
You use Directions service for getting directions from origin to destination location using various forms of transport: walking, driving, cycling, public transit. Get a route from point A to point B.
For Distance Matrix it calculate the travel distance and travel time for multiple origins and destinations, optionally specifying various forms of transport: walking, driving, cycling.
For your case, I will suggest Directions service since you don't need travel time.