Google Maps geocoding API yields ZERO_RESULTS for valid addresses

你。 提交于 2019-12-05 12:59:28

You should be using the Google Places API:

This request

https://maps.googleapis.com/maps/api/place/textsearch/json?query=1054+East+Commerce+Blvd+Slinger+WI+53086&key=INSERT_YOUR_API_KEY_HERE

returns the following json for me:

{
   "html_attributions" : [],
   "results" : [
      {
         "formatted_address" : "1054 E Commerce Blvd, Slinger, WI 53086, USA",
         "geometry" : {
            "location" : {
               "lat" : 43.32459619999999,
               "lng" : -88.2700943
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
         "id" : "fff40888c14fb49758a87b06cfb567dc700f9c2f",
         "name" : "1054 E Commerce Blvd",
         "place_id" : "EiwxMDU0IEUgQ29tbWVyY2UgQmx2ZCwgU2xpbmdlciwgV0kgNTMwODYsIFVTQQ",
         "reference" : "CpQBigAAAJ9o9UeX-dpZYNA7UMTjNzdGfo2-hKh63_7FFlwohjIlTLw-SW9T55YvvaKqLek9w1wTTW1ruwUhZfDfsbMoC4n1Rk0oYbnyKEAsEPgtwuVf-vNgtYqBrHKpRxT5kECSh4O75_GmZzUaypjQqEAKut-ZCz0eMg5fKzgkCXQrUX2o-kLqlj22_hGGKGdApXJ80xIQtvry7J5ah_DxHh0Hv1SwpBoULWCqMnCH34vJY8WzMRD3pVjNS5o",
         "types" : [ "street_address" ]
      }
   ],
   "status" : "OK"
}

You have misspellings in your addresses. For example 7441 Adairsville Hwy is really 7441 Adairsville Rd. Google maps is more forgiving in that it wants to give you a best guess when it can't match the address. In this case, it guessed Rd. For reasons I don't know, the API does not use the same best-guess matching algorithm as Google Map.

Hope this helps.

EDIT: correcting myself. The first address was wrong, but I tried several more of your addresses and they are correct (CSV Pharmacies), and yet the API is showing ZERO_RESULTS as you indicated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!