My Places API returns 'ZERO_RESULTS'

情到浓时终转凉″ 提交于 2019-12-11 20:32:50

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/16123878/my-places-api-returns-zero-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!