谷歌地理编码 API 找不到地点 API 返回的地址



我无法获得Google的Geocode API来识别地址:

squaire 12
是flughafen
60549 Frankfurt Am Main
德国

Squaire是法兰克福机场的一栋建筑物。它似乎没有正常的街道地址,但是Squaire中的许多企业都有" Squaire Number"之类的地址。例如:

  • Alex:Squaire 17,60549 Frankfurt AM,德国Main
  • Bilfinger设施服务GmbH:Squaire 13,Am Flughafen,60549 Frankfurt Am Main,德国

但是,无论我做什么,我都无法获得像Google Geocode API所识别的地址:

  • Squaire 12,Am Flughafen,60549 Frankfurt AM,德国,德国
  • Squaire 12,60549 Frankfurt AM,德国Main
  • 和许多其他变体

疯狂的事情是,当我在机场附近寻找" Squaire"时,API找到了我想要的地方:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=xyz&location=50.050.0509194,8.5684084&am

匹配结果具有:place_id: ChIJY9ZMLL4KvUcRxZhQ3e-7ask。当我查询详细信息时,端点:

https://maps.googleapis.com/maps/api/place/details/json?key=xyz& place = chijy9zmll4kvucrxzhq3e-7ask

我得到formatted_address: "THE Squaire 12, Am Flughafen, 60549 Frankfurt am Main, Germany",但这正是在地理API中无法使用的地址。

,当我将反向地理位置API与place_id一起使用时:

https://maps.googleapis.com/maps/api/geocode/json?key=xyz&place_id = chijy9zmll4kvucrxzhq3e-7ask

我得到formatted_address: "plug and work Frankfurt, THE SQUAIRE Conference Center, THE Squaire 12, Am Flughafen, 60549 Frankfurt am Main, Germany"。在正向地理API中仍然不起作用:

https://maps.googleapis.com/maps/api/geocode/json?address=plug and and Work frankfurt, The Squaire Conference Conference Center, Center20flughafen,%2060549%20 frankfurt%20am%20main,%20Germany

这是地理编码API中的一个问题:问题11031。

它已在1月下旬修复,因此地理编码API始终将返回与Google Maps相同的结果:

  • Squaire 12,Am Flughafen,60549 Frankfurt Am Main,德国==> "formatted_address" : "Am Flughafen, The Squaire 12, 60549 Frankfurt am Main, Germany"
  • Squaire 12,60549 Frankfurt Am Main,德国==> "formatted_address" : "The Squaire, 60549 Frankfurt am Main, Germany"

这实际上是问题11031的固定方式的副作用,并且与地理编码API的原始行为背道而驰。Xomena回答时的答案是有效的,Google Maps API文档的官方建议确实是使用plote api文本搜索。情况更长,因为您会注意到如果您重新阅读了新的前向地理编码器常见问题。

Google GeoCoding API服务不适用于业务列表。您应该使用位置API搜索服务,而不是将API地理编码用于搜索业务。

您可以根据《最佳实践》文章的建议,将API自动完整的位置与地理编码API相结合。在这种情况下,您可以从AutoComplete获得ID并将其用于地理编码API。

请看一下地理编码的最佳实践:https://developers.google.com/maps/documentation/geocoding/best-practices

希望它有帮助!

最新更新