gpt4 book ai didi

api - Google Maps API Geocode Postal Code 并设置国家代码?

转载 作者:行者123 更新时间:2023-12-03 20:18:13 26 4
gpt4 key购买 nike

我正在使用此 API 调用 Google Maps 来获取邮政编码的纬度和经度

http://maps.googleapis.com/maps/api/geocode/json?address=2340&sensor=false

邮政编码在澳大利亚。此 API 调用返回世界各地的地址,地址中包含部分匹配的邮政编码。

有没有可以用来将国家设置为澳大利亚的参数?

谢谢

最佳答案

正确的方法不是通过区域偏置,而是使用 component filtering :

https://maps.google.com/maps/api/geocode/json
?components=country:AU|postal_code:2340
&sensor=false
一些示范:
  • 2340
  • 93274

  • 请注意,如果使用 components 参数,则无需指定 address 参数。

    关于api - Google Maps API Geocode Postal Code 并设置国家代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11747901/

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