首页 > 解决方案 > getQueryPredictions Api 无法获取格式化地址的地址

问题描述

AutocompeteSerive用来从 Google getQueryPredictionsAPI 获取地址。

这是自动完成输入框的初始化:

this.autoComp = new google.maps.places.AutocompleteService({
    componentRestrictions: { 'country': 'in' }
});

this.autoComp.getQueryPredictions({ input: value }, (results, status) => {
    console.log(status);
    if (status == google.maps.places.PlacesServiceStatus.OK) {}
})

步骤1:

用户输入 bangalore

为 Google Api 选择以下谓词:

No. 15, Mysuru Road, Near, Temple, Pancha Mukhi Ganapati Mandir, Kengeri, Bengaluru, 卡纳塔克邦 560060, 印度

将此地址重新发送到相同的 api 以供用户确认:ZERO_RESULTS

有什么解决办法吗?

注意:尝试将相同的地址两次发送到下面的 api 它工作正常..;(

https://maps.googleapis.com/maps/api/geocode/xml?address=No.%2015,%20Mysuru%20Road,%20Near,%20Temple,%20Pancha%20Mukhi%20Ganapati%20Mandir,%20Kengeri,%20Bengaluru ,%20Karnataka%20560060,%20India&sensor=false&key=xxxxxxxxxxxx

标签: google-mapsgoogle-places-api

解决方案


推荐阅读