【问题标题】:Why Google maps API results are not accurate?为什么 Google 地图 API 结果不准确?
【发布时间】:2019-05-21 11:03:54
【问题描述】:

我们使用高级计划进行 google maps api 查找并在使用它时遇到准确性问题 I 用于以下操作。但这些只是例子,可能有很多

52241(应该是Coralville,拉爱荷华市)

43065(应该是鲍威尔,拉肖尼山)

11040(应该是新海德公园,拉花园城)。

我们使用以下网址: https://maps.googleapis.com/maps/api/geocode/json?components=country:US|postal_code:

【问题讨论】:

标签: google-maps google-maps-api-3 google-maps-api-2


【解决方案1】:

您在问题中提到的邮政编码与多个地区重叠。 Google 在地址组件中显示了一个地方,这可能是他们认为最突出的地方。

但是,在响应中,您可以看到邮政编码重叠的地区列表。只需查看响应中的 postcode_localities 字段即可。

例如,对于邮政编码 52241

https://maps.googleapis.com/maps/api/geocode/json?components=postal_code%3A52241%7Ccountry%3AUS&key=YOUR_API_KEY

你会看到

"place_id":"ChIJbaAjdYZD5IcRBfptU5KhMJk",
"postcode_localities":[
    "Coralville","Iowa City","Oakdale"
],
"types":[
    "postal_code"
]

对于邮政编码 43065

https://maps.googleapis.com/maps/api/geocode/json?components=postal_code%3A43065%7Ccountry%3AUS&key=YOUR_API_KEY

响应将包含

"place_id":"ChIJW2TudRTsOIgR8v0-4d19bNA",
"postcode_localities":[
    "Powell","Shawnee Hills"
],
"types":[
    "postal_code"
]

最后是邮政编码 11040

https://maps.googleapis.com/maps/api/geocode/json?components=postal_code%3A11040%7Ccountry%3AUS&key=YOUR_API_KEY

你会得到

"place_id":"ChIJ28UCx5hiwokRf_9UXmJHg5I",
"postcode_localities":[
    "GARDEN CITY P","Garden City Park","Hillside Manor","Manhasset Hills","New Hyde Park","North Hills","North New Hyde Park"
],
"types":[
    "postal_code"
]

请注意,您要查找的位置存在于 postcode_localities 数组中。

我希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2016-11-10
    • 1970-01-01
    • 2017-07-14
    • 1970-01-01
    • 2020-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-07
    相关资源
    最近更新 更多