Why distance matrix api always returning the statu

2019-07-18 00:11发布

问题:

I am using the distance matrix api to calculate the distance between one source and multiple destinations. The source latitude / longitude and destination latitudes / longitudes are perfect. Also the route is existing in Google maps between those points. But the api is always returning the status "ZERO_RESULTS". What is the reason for this issue and how it could be solved.

The response from distance matrix api is as follows :

"rows" : [

 {

  "elements" : [

  {

    "status" : "ZERO_RESULTS"

 },

{

    "status" : "ZERO_RESULTS"

},

.

.

.

.

):  }

] } ],  "status" : "OK" }

回答1:

As per Google Description distance matrix api

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=Washington,DC&destinations=New+York+City,NY&key=YOUR_API_KEY

may be there's something wrong implementation in your code try this way :)