Rgv
Rgv

Reputation: 522

why google apis show different results?

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?

Upvotes: 0

Views: 1028

Answers (1)

Android Surya
Android Surya

Reputation: 544

As Google Document

Direction API

Note: This service is not designed to respond in real time to user input. For dynamic directions calculations (for example, within a user interface element)

Distance Matrix API

The Google Maps Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations, based on the recommended route between start and end points.

Direction API may give response dynamic directions calculation i.e directions for several modes of transportation, including transit, driving, walking or cycling.

So Result may be changed for Direction API and Distance Matrix API

Upvotes: 1

Related Questions