我希望在我的iOS应用程序中构建一个相当基础的地址搜索功能。我使用Google Places Autocomplete根据用户输入查询结果,如下:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=shoppers@&radius=160934&location=50.445210,-104.618896&components=country:ca&key=xxxxxxxxxxxxx
我得到的结果太模糊,无法实际应用。以下是一个示例,在这个示例中,我只获得了企业名称和街道名称。问题在于,这家企业在同一条街上有三个不同的位置,所以如果没有提供街道号码,用户该如何确定他们选择的是哪一个位置呢?
{
"description" : "Shoppers Drug Mart, Albert Street, Regina, SK, Canada",
"id" : "94065830c922a4239ece26102fb3439fa2f2e155",
"matched_substrings" : [
{
"length" : 8,
"offset" : 0
}
],
"place_id" : "ChIJ4XzAGbCgHlMRGSFBsEbyfCE",
"reference" : "ChIJ4XzAGbCgHlMRGSFBsEbyfCE",
"structured_formatting" : {
"main_text" : "Shoppers Drug Mart",
"main_text_matched_substrings" : [
{
"length" : 8,
"offset" : 0
}
],
"secondary_text" : "Albert Street, Regina, SK, Canada"
},
"terms" : [
{
"offset" : 0,
"value" : "Shoppers Drug Mart"
},
{
"offset" : 20,
"value" : "Albert Street"
},
{
"offset" : 35,
"value" : "Regina"
},
{
"offset" : 43,
"value" : "SK"
},
{
"offset" : 47,
"value" : "Canada"
}
],
"types" : [ "pharmacy", "health", "point_of_interest", "store", "establishment" ]
},