Distance Matrix API: Zip Code 70128 returns zero r

2019-07-18 22:18发布

问题:

Here's a little puzzler. If I search for a distance involving area code 70128, like so:

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=40.6782%2C-73.9442&destinations=new+orleans+LA+70128

I get a ZERO_RESULTS status. But I do get results if I do the same search with only the New Orleans zip code changed to a nearby one, like so:

https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=40.6782%2C-73.9442&destinations=new+orleans+LA+70129

70128 is a legitimate zip code for New Orleans, so I should get results. Interestingly, when I get no results my origin address is displayed just as I gave it (in lat/lng coordinates), but when I do get results it knows to convert it to an address. That may or may not provide a clue.

I've even gone so far as to merely provide a zip code for the origin and destination with similar results.

I can also swap zip code 70128 to an origin instead of a destination. It just seems like the API does not like this zip code for some reason, and I've no idea why that could be. Does anybody have some insight to this?

Result of first URL:

{
  destination_addresses: [
    "New Orleans, LA 70128, USA"
  ],
  origin_addresses: [
    "40.6782,-73.9442"
  ],
  rows: [
    {
      elements: [
      {
        status: "ZERO_RESULTS"
      }
      ]
    }
  ],
  status: "OK"
}

Result of second URL:

{
  destination_addresses: [
    "New Orleans, LA 70129, USA"
  ],
  origin_addresses: [
    "57 Atlantic Ave, Brooklyn, NY 11216, USA"
  ],
  rows: [
    {
        elements: [
        {
          distance: {
          text: "1,294 mi",
          value: 2081879
        },
        duration: {
          text: "19 hours 7 mins",
          value: 68835
        },
        status: "OK"
      }
    ]
  }
  ],
  status: "OK"
}

回答1:

Looks to me like the 70128 zip code is geolocated in the middle of Lake Pontchartrain. Driving directions will fail if there aren't any roads near that point.

If I take that point and move it to a road (say the I-10 at 30.061671,-89.936772), I get a result



回答2:

The pin of that zip code is in the water. That is probably the reason why the api returns no result. If you compare that with 70126, you will see that 70126 works because the pin that marks the location of that zip code is not in the water even though most of the area for that zip code marked by Google Maps is in the water.