Google maps Clojurescript-无法在Google Places自动完成API中限制城市

Google maps Clojurescript-无法在Google Places自动完成API中限制城市,google-maps,google-places-api,clojurescript,Google Maps,Google Places Api,Clojurescript,我想搜索特定位置周围的地方。我尝试使用选项“位置”、“半径”和“边界”。但是,它总是返回所有在美国的地址 我的代码如下所示: (def Autocomplete (oget js/window "google.maps.places.Autocomplete")) (defn mount-autocomplete [ctx form-props el] (let [autocomplete (Autocomplete. el #js {:location #js {:lat 40.73061

我想搜索特定位置周围的地方。我尝试使用选项“位置”、“半径”和“边界”。但是,它总是返回所有在美国的地址

我的代码如下所示:

(def Autocomplete (oget js/window "google.maps.places.Autocomplete"))
(defn mount-autocomplete [ctx form-props el]
  (let [autocomplete (Autocomplete. el #js {:location #js {:lat 40.730610 :lng -73.935242} :radius 15 :strictBounds true :rankBy google.maps.places.RankBy.DISTANCE :componentRestrictions #js {:country "US"}})]
    (ocall autocomplete "addListener" "place_changed"
           (fn []
            (this-as this
              (let [place (js->clj (ocall this "getPlace") :keywordize-keys true)
                    formatted-address (join-address-parts (place->address place))]
                (js/console.log formatted-address)
                (oset! el "value" (:street formatted-address))
                (doseq [[k v] formatted-address]
                  (<cmd ctx :on-change [form-props [:address k] nil v nil]))))))))
(def Autocomplete(oget js/window“google.maps.places.Autocomplete”))
(定义安装自动完成[ctx表单道具el]
(让[autocomplete(autocomplete.el#js{:location{:lat 40.730610:lng-73.935242}:radius 15:strictBounds true:rankBy google.maps.places.rankBy.DISTANCE:componentRestrictions{:country“US”})]
(ocall自动完成“addListener”“更改位置”
(fn[]
(这个和这个一样
(让[place(js->clj(ocall this“getPlace”):关键字设置为true)
格式化地址(连接地址部分(地点->地址地点))]
(js/console.log格式的地址)
(oset!el“value”(:街道格式的地址))
(doseq[[k v]格式化地址]

(要使
strictBounds
属性起作用,需要传递边界对象,而不是文档中提到的位置和半径

设置
strictBounds
选项以将结果限制在给定范围内,即使视口发生更改

bounds
参数必须是
LatLngBounds
对象或
LatLngBoundsLiteral

如果使用
bounds
strictBounds:true
则不需要国家/地区组件限制,并且/或者可能与给定的边界冲突