我的Places API返回'ZERO

编程入门 行业动态 更新时间:2024-10-27 19:29:12
我的Places API返回'ZERO_RESULTS'(My Places API returns 'ZERO_RESULTS')

我的网站显示了几个地方类别(咖啡馆,药房,银行等等)的Gmap。有些类别总是返回'ZERO_RESULTS',而只有两个返回结果。

以下是良好请求的示例 - https://maps.googleapis.com/maps/api/js/PlaceService.FindPlaces?1m6&1m2&1d32.0644854235794&2d34.78186263896919&2m2&1d32.073468576420595&2d34.79246336103074&2siw&6sparking&callback=_xdc_._pocujy&token=76152

以下是错误请求的示例 - https://maps.googleapis.com/maps/api/js/PlaceService.FindPlaces?1m6&1m2&1d32.0644854235794&2d34.78186263896919&2m2&1d32.073468576420595&2d34.79246336103074&2siw&6sbank&callback=_xdc_._g07omw&token=49745

如你所见,'坏'请求会返回 -

_xdc_._g07omw && _xdc_._g07omw( { "html_attributions" : [], "results" : [], "status" : "ZERO_RESULTS" })

对我地图上的任何位置(以色列地图),答案是零 地方确实存在并且应该出现(例如在maps.google.co.il中)

你知道这里有什么问题吗?

My site shows Gmap with few places categories (cafe, pharmacy. bank, etc...) Some categories ALWAYS returns 'ZERO_RESULTS' while Only two returns results.

Here is an example for a good request- https://maps.googleapis.com/maps/api/js/PlaceService.FindPlaces?1m6&1m2&1d32.0644854235794&2d34.78186263896919&2m2&1d32.073468576420595&2d34.79246336103074&2siw&6sparking&callback=_xdc_._pocujy&token=76152

Here is an example for a bad request- https://maps.googleapis.com/maps/api/js/PlaceService.FindPlaces?1m6&1m2&1d32.0644854235794&2d34.78186263896919&2m2&1d32.073468576420595&2d34.79246336103074&2siw&6sbank&callback=_xdc_._g07omw&token=49745

As you can see the 'bad' request returns this-

_xdc_._g07omw && _xdc_._g07omw( { "html_attributions" : [], "results" : [], "status" : "ZERO_RESULTS" } )

The answer is ZERO for any location on my map (Israel Map) The Places do exist and should appear (like in maps.google.co.il)

Do you have an idea what's wrong here?

最满意答案

这种行为的原因很可能是Google尚未将实际类别( types )添加到其数据库中的所有位置。 因此,例如,一个你确实知道它应该以"types" : [ "cafe", "restaurant", "establishment" ]返回的地方"types" : [ "cafe", "restaurant", "establishment" ] ,它将仅返回"types" : [ "establishment" ] 。

因此,在包含缺失types之前,不太精确的解决方法可能是按name或keyword参数过滤这些类别,这可能会增加返回(至少某些)相关结果的机会。

The reason for this behavior is most likely the fact that Google hasn't yet added the actual categories (types) to all the places in its database. So, for example, a place which you actually know that it should return with "types" : [ "cafe", "restaurant", "establishment" ], it will return instead with only "types" : [ "establishment" ].

So, until the missing types are included, a less-precise workaround might be filtering those categories by name or keyword parameter, which might increase the chances of returning (at least some) relevant results.

更多推荐

本文发布于:2023-07-18 04:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1154957.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Places   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!