Google Distance Matrix API returns 'ZERO_RESULTS'

Question:

Google Distance Matrix API keep returning ‘ZERO_RESULTS’. I checked my request twice and couldn’t find any problem, pls help.

This is my request url:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=-77.18457758276422,38.93989291394156&destinations=-77.07489935925479,38.743491801018926&mode=walking&key=xxxx

result I got:

{  
   destination_addresses:[  
      "-77.074899359254786,38.743491801018926"
   ],
   origin_addresses:[  
      "-77.18457758276422,38.939892913941563"
   ],
   rows:[  
      {  
         elements:[  
            {  
               status:"ZERO_RESULTS"
            }
         ]
      }
   ],
   status:"OK"
}
Asked By: Bingzi Li

||

Answers:

I’ve found out where the problem was.

When I tried to search IDs for each place and used IDs as the parameters, it worked. My geospatial data comes from reliable source and is up to date. Therefore my best guess is that my lat/long data is slightly different to Google’s lat/long data, and Google Distance Matrix API is not intelligent enough to do some approximation to locate a route.

So if you are using this API and your lat/long data comes from other sources instead of Google, it will probably fail. Better have place ID.

If there are developers who have the same problem, hope this provides you some help.

Answered By: Bingzi Li

No direction route or ZERO_RESULTS are returned when no route could be found between the origin and destination. may be their is problem with lat/lng. you can try same with lat/lng replacing with Place ID .may be it works.

Answered By: Pranali Kurumkar