首页 文章

Google地理编码API无法找到地方API返回的地址

提问于
浏览
2

我不能让谷歌的geocode api识别地址:

Squaire 12
Am Flughafen
60549法兰克福
德国

Squaire是法兰克福机场的一座建筑 . 它似乎没有正常的街道地址,但The Squaire的许多企业都有“The Squaire NUMBER”这样的地址 . 例如:

但无论我做什么,我都无法获得谷歌geocode api认可的地址:

令人抓狂的是,当我在机场附近搜索“squaire”时,地方API会找到我正在寻找的地方:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=XYZ&location=50.0509194,8.5684084&radius=1000&keyword=squaire

匹配结果为: place_id: ChIJY9ZMLL4KvUcRxZhQ3e-7ask . 当我查询详细信息 endpoints 时:

https://maps.googleapis.com/maps/api/place/details/json?key=XYZ&placeid=ChIJY9ZMLL4KvUcRxZhQ3e-7ask

我得到 formatted_address: "THE Squaire 12, Am Flughafen, 60549 Frankfurt am Main, Germany" ,但's exactly the address that won'在地理编码api中工作 .

当我使用带有place_id的反向地理编码api时:

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%20and%20work%20Frankfurt,%20THE%20SQUAIRE%20Conference%20Center,%20THE%20Squaire%2012,%20Am%20Flughafen,%2060549%20Frankfurt%20am%20Main,%20Germany

2 回答

  • 4

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

    它已于1月下旬修复,因此Geocoding API将始终返回与Google Map 相同的结果:

    这实际上是Issue 11031如何修复的副作用,并且与原始编码API的原始行为背道而驰 . xomena 's answer was valid at the time he answered, the official recommendation from the Google Maps API documentation was indeed to use Places API Text Search. This is on longer the case, as you' ll请注意,如果您重新阅读New Forward Geocoder FAQ .

  • 1

    Google地理编码API服务不适用于商家信息 . 您应该使用Places API search服务而不是地理编码API来搜索商家 .

    您可以按照最佳做法文章中的建议,将Places API自动填充功能与Geocoding API结合使用 . 在这种情况下,您可以从自动填充中获取地点ID,并在地理编码API中使用它 .

    请查看地理编码最佳做法:https://developers.google.com/maps/documentation/geocoding/best-practices

    希望能帮助到你!

相关问题