gpt4 book ai didi

google-maps - Google Maps Places API 只返回城市?

转载 作者:行者123 更新时间:2023-12-03 22:23:53 24 4
gpt4 key购买 nike

我正在尝试使用 Google 的 map API 仅从他们的 json 请求中返回城市:

 https://maps.googleapis.com/maps/api/place/autocomplete/json?input=green%20lanes&types=geocode&sensor=false&types=regions&key=*API KEY HERE*

关键是 &types=regions但它仍然返回所有结果。

例如,我正在搜索街道 Green Lanes而不是返回可能包含 Green Lanes 的城市它返回伦敦的街道作为最佳结果。

最佳答案

这是一个老问题,但接受的答案对于特定问题是不正确的。types 的正确参数仅返回城市的参数是 (cities) .所以完整的 URL 将是:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=green%20lanes&types=(cities)&key= API_KEY_HERE
您可以查看更多信息here .另外,我省略了 sensor参数自 it's not needed anymore .

关于google-maps - Google Maps Places API 只返回城市?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16132591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com