stenci
stenci

Reputation: 8481

Calculating the distance with some zip codes fails

The difference between the following two requests is on the destination zip code: the first is 60601 and the second is 60602.

Both 60601 and 60602 are recognized by this test page, but the first one is not recognized by the requests below and the returned status is "status" : "NOT_FOUND".

Why is it possible to calculate the distance between 89139 and 60602, but the distance between 89139 and 60601 fails?

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=89139&destinations=60601&key=<my key>
https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=89139&destinations=60602&key=<my key>

Upvotes: 0

Views: 477

Answers (1)

geocodezip
geocodezip

Reputation: 161334

Possible workarounds:

  1. add Chicago, IL to the zip code:

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=89139&destinations=Chicago,%20IL%2060601

  1. add IL to the zip code:

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=89139&destinations=IL%2060601

  1. add "zip:" to the zip code:

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=89139&destinations=zip:60601

(not sure why that zip code returns: "destination_addresses" : [ "" ], but adding pretty much anything to that number yields the correct result)

Upvotes: 1

Related Questions