我的地方API返回"ZERO_RESULTS" [英] My Places API returns 'ZERO_RESULTS'

查看:88
本文介绍了我的地方API返回"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中)

您知道这里出了什么问题吗?

解决方案

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

因此,在包含缺少的types之前,不太精确的解决方法可能是通过namekeyword参数过滤那些类别,这可能会增加返回(至少一些)相关结果的机会. /p>

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?

解决方案

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.

这篇关于我的地方API返回"ZERO_RESULTS"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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