之间有什么区别?附近搜索 和 文字搜索 在 Google Places API 中?
例如,附近搜索1km半径内的cafe只返回1个结果使用 https://maps.googleapis.com/maps/api/place/ 附近搜索/json? location=-41.319282,174.818717
& radius=1000
& sensor=true
& types=cafe
& key=your_api_key
而 text 搜索半径1km内的cafe,返回20条结果使用 https://maps.googleapis.com/maps/api/place/ 文本搜索 /json? location=-41.319282,174.818717
& radius=1000
& sensor=true
& query=cafe
& key=your_api_key
.
更改 类型 至类型 在 附近搜索还返回 20 个结果,这些结果也与使用上面的文本搜索找到的结果不同。即https://maps.googleapis.com/maps/api/place/nearbysearch/json ? location=-41.319282,174.818717
& radius=1000
& sensor=true
& type=cafe
& key=your_api_key
当你做 在谷歌地图安卓应用程序上搜索咖啡馆使用上面给出的位置,您获得的结果与使用上面的文本搜索获得的结果相同。
为方便起见,以上clickable links
在下面。
https://maps.googleapis.com/maps/api/place/textsearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&query=cafe&key=
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&type=cafe&key=
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&types=cafe&key=
最佳答案
简单地放置附近的地方可以让您进行更模糊的搜索,但只返回特定的结果。
在文本搜索中,如果您搜索“restaurants”,它将搜索带有“restaurants”文本的位置、场所或名称。任何与餐馆相关的内容。
同时在附近搜索中,如果您搜索“restaurants”,它将返回带有或不带有“restaurants”文本的餐厅场所,但仅返回“restaurants”的场所
关于search - Google Places API 中的附近搜索和文本搜索之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16620053/