3
我目前坚持使用此功能,其中用户需要基于距离的附近地点结果。从Google API获取附近的地方按距离排序
对于如: - 如果我搜索“高知”,我在印度 然后科钦是印度以及日本 所以结果应该是像 1.高知,印度 2.高知,日本
这只是一个例子,用户还可以搜索地标,城市,街道等。但我想所有结果由distance.Closer结果进行排序显示,然后再远的地方。但不能按照要求得到结果。
类似的功能在Android上做,他们是通过传递半径(从当前位置像500公里)使用它
是我迄今为止尝试: -
- 使用GMSPlacesClient.autocompleteQuery和传球在边界它当前的位置
GMSPlacesClient().autocompleteQuery(txtLocation.text!, bounds: bounds, filter: filter, callback: {(results, error) -> Void in
if let error = error {
print("Autocomplete error \(error)")
return
}
if let results = results {
}
})
- 使用GOOGL ePlaces.placeAutocomplete
GooglePlaces.placeAutocomplete(forInput: self.txtLocation.text!, offset: 0, locationCoordinate: nil, radius: nil, language: nil, types: [GooglePlaces.PlaceType.Regions], components: nil, completion: { (response, error) in
// To do
})
- 我也用这个URL(https://maps.googleapis.com/maps/api/place/autocomplete/json?input=pan&location=30.704316,76.712106&radius=50000&components=country:IN)为谷歌API,但对于这些类型的替代品,我必须做的自定义分析。