google-maps - 谷歌地图地理编码 api 返回无效邮政编码的结果
问题描述
Google 地理编码 API 返回以下邮政编码的结果:“0”、“00”、“000”、“00000”
点击此 api 后 - https://maps.googleapis.com/maps/api/geocode/json?address=00000&key=mysecretkey 它返回“formatted_address”:“6009 Wayzata Blvd Suite #108, St Louis Park, MN 55416, USA "
这些是有效的邮政编码吗?理想情况下,它不应该返回结果。
解决方案
您应该注意以下几点:
当您
address=00000
在 Geocoding API 请求中发送参数时,它将在格式化的地址或地名中搜索匹配。在这种情况下,服务不会只匹配邮政编码。Google 的数据库中可能有错误的数据,可能会导致意外结果。
在您的示例中,它似乎是 Google 数据库中的错误数据。
让我们看看您的请求的响应
https://maps.googleapis.com/maps/api/geocode/json?address=00000&key=YOUR_API_KEY
正如您在响应中看到的,地点 ID 是“ChIJgyA2iZU0s1IReyHBw0yPjZg”。现在检查此地点 ID 的地点详细信息请求的输出
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJgyA2iZU0s1IReyHBw0yPjZg&key=YOUR_API_KEY
响应将包含以下内容
{
....
id: "3fff72184719b7835304f285f40e677e9914933e",
international_phone_number: "+1 763-300-8722",
name: "00000",
place_id: "ChIJgyA2iZU0s1IReyHBw0yPjZg",
formatted_address: "6009 Wayzata Blvd Suite #108, St Louis Park, MN 55416, USA",
types: [
"lodging",
"point_of_interest",
"establishment"
],
.....
}
请注意,该商家在 Google 数据库中的名称为“00000”,因此 Geocoding API 正在按预期工作,但显然这里存在数据问题。
您可以使用此链接查看该地点并向 Google 报告不良数据
https://maps.google.com/?cid=10992599825345749371
我希望这有帮助!
推荐阅读
- python - 如何将 NumPy 1.18.5 for Python3.8 与 Anaconda 一起使用?
- wix - Wix Toolset MajorUpgrade - 合并文件
- javascript - 从 javascript 文件播放视频
- arrays - 如何减少 c 中的 char 指针以指向特定的第一个字符
- reactjs - React Material-Table onSelectionChange 将数据传递给钩子状态
- vba - 共享收件箱你如何让 vba 去那里而不是我自己的收件箱
- html - 如何在css中遵循较低的最大宽度
- javascript - 如何根据foreignObject的高度动态调整D3 rect的大小
- angular - 将组件加载到 HTML 元素
- r - 如何通过用向量对索引矩阵来获取向量?