google-地图地理编码 API 无结果

google-maps geocoding API no results

有人能告诉我为什么调用 Google 地理编码 API returns 没有结果。 https://maps.googleapis.com/maps/api/geocode/json?address=1226%20Freeport%20Road+Defuniak%20Springs+FL+32433

您可以使用 Places API 请求找到此地址:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=1226%20Freeport%20Road%20Defuniak%20Springs%20FL%2032433&key=YOUR_API_KEY

为什么使用地理编码找不到它 API?如果您检查 Places API 的回复,您将看到以下内容:

"results":[
{
  "formatted_address":"1226 Freeport Road, Defuniak Springs, FL 32433, United States",
  "geometry":{
    "location":{
      "lat":30.7045583,"lng":-86.1251103
    }
  },
  "icon":"https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
  "id":"bcb674fa738a9af907230e17fb25014a498d7987",
  "name":"Subway",
  "opening_hours":{
    "open_now":true,
    "weekday_text":[

    ]
  },
  "place_id":"ChIJn1aPjK3Rk4gRL0ZTnQtbwS0",
  "price_level":1,
  "reference":"CmRRAAAAvNQhXr-Zgrhc2HdI8hECvgzuLZQfTgP1MdA0oH-db5-8SPiXOLIsKYYMYUCTEQreUdP4JwV-EBZJhttf52dUFCOBzAHF7iOrgvtEnDpe_EcoBqg6z_bPo14X9_CW9ZafEhApON7yxIXlHbhjqdz7qe37GhTWK5ifCApitBrSehqI8bIG03Z2IQ",
  "types":[
    "restaurant","food","point_of_interest","establishment"
  ]
},....

请注意,此地点的类型为 "restaurant"、"food"、...因此它代表一家企业。地理编码 API 过滤掉所有企业,仅适用于街道地址类型的要素。

您可以使用 Map Maker 自行创建街道地址:

https://mapmaker.google.com/mapmaker

希望对您有所帮助!