Google Maps TextSearch API返回空结果

时间:2019-07-11 07:00:03

标签: google-maps

我正在使用Google textsearch API搜索“ CITY_NAME”中的热门景点。直到昨天,它一直在返回数据,但是当我现在尝试时,它没有返回结果!这是怎么回事,为什么,我得到ZERO_RESULTS

Ex:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=top attractions in bengaluru&language=en&key=MY_API_KEY

我正在期待返回如下结果

{
   "html_attributions": [],
   "results": [
      {
         "formatted_address": "Mavalli, Bengaluru, Karnataka 560004, India",
         "geometry": {
            "location": {
               "lat": 12.9507432,
               "lng": 77.5847773
            },
            "viewport": {
               "northeast": {
                  "lat": 12.9578032,
                  "lng": 77.59536344999999
               },
               "southwest": {
                  "lat": 12.9424072,
                  "lng": 77.57495644999999
               }
            }
         },
         "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_recreational-71.png",
         "id": "8ae4a9c5e9c2b40e58bf0c947e5502ff9ef71c29",
         "name": "Lalbagh Botanical Garden",
         "opening_hours": {
            "open_now": true
         },
         "photos": [
            {
               "height": 4032,
               "html_attributions": [
                  "<a href=\"https://maps.google.com/maps/contrib/104005508763994607427/photos\">S.Ravindra Kumar</a>"
               ],
               "photo_reference": "CmRaAAAAYzPzHyHDleeTK4pM19jZ16SfDbG7lLZCrgr2wDEE_eNqDB5HdH670V0MXBRw03HH_HvFg0Rfe1dEZeG18NVVcxMUtpIOoHbN4a-csy0zqYRiJrTibapAiCxbYr8GKWrDEhBQAFmvTdSMKhoYbPlWmb-UGhSp70QBfrJgnUYSl5g_Ih24d80zIg",
               "width": 3024
            }
         ],
         "place_id": "ChIJHdPykcEVrjsRIr4v35kLEY4",
         "plus_code": {
            "compound_code": "XH2M+7W Bengaluru, Karnataka, India",
            "global_code": "7J4VXH2M+7W"
         },
         "rating": 4.4,
         "reference": "ChIJHdPykcEVrjsRIr4v35kLEY4",
         "types": [
            "park",
            "point_of_interest",
            "establishment"
         ],
         "user_ratings_total": 108174
      },
      {
         .......
         .......
      }
   ]
}


但是我得到以下答复。

响应

{
   "html_attributions" : [],
   "results" : [],
   "status" : "ZERO_RESULTS"
}

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

请注意,“吸引力”是非常广泛的输入;从博物馆到公园再到动物园,它可能涉及各种各样的兴趣点,地点类型等。

请在查询中使用更具体的地点类型。例如:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=top%20restaurants%20in%20bengaluru&language=en&key=MY_API_KEY

希望这能回答您的问题!