Why Google direction and distance matrix API show

2019-07-11 08:12发布

问题:

I am trying to get distance and duration using google direction API

https://maps.googleapis.com/maps/api/directions/json?origins=latitude,longitude&destinations=latitude,longitude&&mode=driving&key=xxxxxxxxxxxxxxxxxxxxx

and its working fine and get the distance and duration like this

  distance="30 m"
  duration="1 min"

when am trying get distance and duration using distancematrix api,

https://maps.googleapis.com/maps/api/distancematrix/json?origins=latitude,longitude&destinations=latitude,longitude&&mode=driving&key=xxxxxxxxxxxxxxxxxxxxx

  "distance" : {
                  "text" : "1.2 km",
                  "value" : 1168
               },
               "duration" : {
                  "text" : "2 mins",
                  "value" : 140
               }

Note: Passing same latitude and longitude values for both API. Why both API showing different results for same latitude and longitude values?