26

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

例如,使用 https://maps.googleapis.com/maps/api/place/nearthsearch /json?1 公里半径内搜索附近的咖啡馆仅返回 1 个结果?&&&& _ _ _location=-41.319282,174.818717radius=1000sensor=truetypes=cafekey=your_api_key

而使用https://maps.googleapis.com/maps/api/place/ textsearch /json?对半径 1 公里内的咖啡馆进行文本搜索会返回 20 个结果?& & & & 。location=-41.319282,174.818717radius=1000sensor=truequery=cafekey=your_api_key

更改类型以在附近搜索中键入也会返回 20 个结果,这些结果也与使用上面的文本搜索找到的结果不同。即https://maps.googleapis.com/maps/api/place/nearbysearch/json?&&&& _ _ _location=-41.319282,174.818717radius=1000sensor=truetype=cafekey=your_api_key

当您使用上面给出的位置在 google maps android 应用程序上搜索 cafe 时,您获得的结果与使用上面的文本搜索获得的结果相同。

为方便起见,上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=

4

1 回答 1

8

简单地放置附近的地方可以让您进行更模糊的搜索,但只返回特定的结果。在文本搜索中,如果您搜索“restaurants”,它将搜索带有“restaurants”文本的位置、场所或名称。任何与餐馆相关的内容。同时在附近搜索中,如果您搜索“restaurants”,它将返回带有或不带有“restaurants”文本的餐厅场所,但仅返回“restaurants”的场所

于 2013-06-21T02:06:21.807 回答