Google Places API中附近搜索和文本搜索之间的区别 [英] difference between a nearby search and a text search in Google Places API

查看:123
本文介绍了Google Places API中附近搜索和文本搜索之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Places API中的附近搜索文本搜索有什么区别?

例如,使用附近的半径1公里之内的咖啡馆搜索只会返回1个结果. rel ="noreferrer"> https://maps.googleapis.com/maps/api/place/ nearbysearch /json?location=-41.319282,174.818717& radius=1000& sensor=true & types=cafe& key=your_api_key

文本使用 https://maps.googleapis.com/maps/api/place/nearbysearch/json ?location=-41.319282,174.818717& radius=1000& sensor=true& type=cafe & key=your_api_key

当您使用上面给出的位置在Google地图android应用上搜索咖啡馆时,得到的结果与通过上面的文本搜索得到的结果相同.

为方便起见,上面的clickable links在下面.

解决方案

简单地放在附近的地方可以让您更模糊地搜索,但只返回特定的结果. 在文本搜索中,如果您搜索餐厅",它将搜索带有餐厅"文本的位置,场所或名称.与餐厅有关的所有信息. 同时,在附近搜索中,如果您搜索"restaurants",它将返回带有或不带有"restaurants"文本的餐馆场所,而仅返回"restaurants"的场所.

Whats the difference between a nearby Search and a text Search in Google Places API?

For example, a nearby Search for cafe within a radius of 1km returns only 1 result using https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&types=cafe&key=your_api_key

while text Search for cafe within a radius of 1km returns 20 results using https://maps.googleapis.com/maps/api/place/textsearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&query=cafe&key=your_api_key.

Changing types to type in the nearby search also returns 20 results which are also different to the result found using the text search above. ie https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-41.319282,174.818717&radius=1000&sensor=true&type=cafe&key=your_api_key

When you do a search for cafe on google maps android app using the location given above, the result you get is the same as the result you get by using the text search above.

For convenience, the above clickable links are below.

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=

解决方案

Simply put nearby places allows you to search more vaguely but only return specific results. In Text Search, if you search for "restaurants", it will search for locations, establishments or names with the text "restaurants".Anything that is related to restaurants. Meanwhile in nearby search, if you search for "restaurants", it will return restaurant establishments with or without the text "restaurants" but only establishments of "restaurants"

这篇关于Google Places API中附近搜索和文本搜索之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆