【问题标题】:Restrict google autocomplete to one country when using no libraries不使用库时将 Google 自动完成功能限制在一个国家/地区
【发布时间】:2022-01-15 12:18:29
【问题描述】:

我正在发出这样的自动完成 API 请求。

https://maps.googleapis.com/maps/api/place/queryautocomplete/json&key=mykey&input=ko

这工作正常。但是我们如何才能将结果限制在一个国家/地区?

我尝试使用docs 中提到的组件传递国家/地区限制,如下所示。
https://maps.googleapis.com/maps/api/place/queryautocomplete/json&key=mykey&input=ko&components=country:fr。但它仍然返回所有国家。有人能告诉我正确的方法吗?

【问题讨论】:

    标签: google-maps google-places-api googleplacesautocomplete


    【解决方案1】:

    组件可用于放置自动完成方法 (https://developers.google.com/maps/documentation/places/web-service/autocomplete),但不适用于查询自动完成方法 (https://developers.google.com/maps/documentation/places/web-service/query)。

    您提供的参数被忽略。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-20
      • 2012-07-02
      • 2016-01-25
      • 1970-01-01
      • 2019-08-22
      • 2017-12-23
      相关资源
      最近更新 更多