0
votes

I can call Google Maps Distance Matrix API in two ways:-

1) with single origins zip code and single destinations zip code eg: https://maps.googleapis.com/maps/api/distancematrix/json?origins=48084&destinations=48326&key=" + API_KEY

2) with array of origins zip code and array destinations zip code eg : https://maps.googleapis.com/maps/api/distancematrix/json?origins=48084%7C48098%7C48309&destinations=48326%7C48306&key=" + API_KEY

1) How the request/day is counted in case 1 and case 2?

2) Can I save the distance and time locally in the cache of DB for performance benefit ?

1

1 Answers

0
votes

Case1: Here you are using single origin and single destination.So, If you are want multiple conversions then you need to hit this api multiple times which incurs multiple request.

       origin     destination    #Request
         A           B             1
         A           C             1
-------------------------------------------------------------
              Total Request        2

Case2: In this case you can achieve multiple conversions with a single api hit,means its just single request.

      orgin    destination     #Request
        A           B,C          1
--------------------------------------------------------------
              Total Request      1

Conclusion: Case2 is less expensive in terms of no of api request