首页 > 解决方案 > HERE Maps API:如何搜索 100 多个地点

问题描述

这里的地图提供了一个 API 来搜索地图中的地点。如果没有提供阈值,默认情况下,它会返回一个包含 20 个结果的 json。然而,在 json 中,还提供了结果下一页的 url 。但是,尽管如此,我总共无法获得超过 100 个结果。

https://places.cit.api.here.com/places/v1/discover/search?app_id=/////myAppId/////&app_code=/////myAppCode/////&q= rewe&in=52.521,13.3807;r=624715.0

通话结果:

{
  "results": {
    "next": "https://places.cit.api.here.com/places/v1/discover/search;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmb2Zmc2V0PTEwJnNpemU9MTA?in=52.521%2C13.3807%3Br%3D624715.0&q=rewe&app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
    "items": [{
        "position": [
          52.52045,
          13.38844
        ],
        "distance": 527,
        "title": "REWE City",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Friedrichstraße 100<br/>Mitte, 10117 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276u33db-478f50cd5ded4446a1a0c82616ffdedf;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0w?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276u33db-478f50cd5ded4446a1a0c82616ffdedf",
        "openingHours": {
          "text": "Mon-Sat: 07:00 - 23:30",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T070000",
            "duration": "PT16H30M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.52568,
          13.36847
        ],
        "distance": 977,
        "title": "Rewe",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Europaplatz 1<br/>Moabit, 10557 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276u33db-cea8ce21a43348229139e7ce91e9dcbc;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0x?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276u33db-cea8ce21a43348229139e7ce91e9dcbc",
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.52961,
          13.38399
        ],
        "distance": 983,
        "title": "REWE",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Chausseestraße 118<br/>Mitte, 10115 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276u33db-1f765b467b8d49a992b787580ee4a583;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0y?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276u33db-1f765b467b8d49a992b787580ee4a583",
        "openingHours": {
          "text": "Mon-Sat: 08:00 - 23:00",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T080000",
            "duration": "PT15H00M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.51238,
          13.39002
        ],
        "distance": 1147,
        "title": "REWE",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Friedrichstraße 67<br/>Mitte, 10117 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-56fd3ec94cad047f686ce22f4ce9e99d;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0z?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276jx7ps-56fd3ec94cad047f686ce22f4ce9e99d",
        "openingHours": {
          "text": "Mon-Sat: 08:00 - 22:00",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T080000",
            "duration": "PT14H00M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.50813,
          13.37448
        ],
        "distance": 1492,
        "title": "REWE",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Alte Potsdamer Straße 7<br/>Tiergarten, 10785 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-dfc2afc7bbd60188a0bc0d07cd441c55;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz00?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276jx7ps-dfc2afc7bbd60188a0bc0d07cd441c55",
        "openingHours": {
          "text": "Mon-Sat: 09:00 - 21:00",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T090000",
            "duration": "PT12H00M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.53245,
          13.39711
        ],
        "distance": 1689,
        "title": "REWE",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Invalidenstraße 158<br/>Mitte, 10115 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276u33db-771494bd265e4c97be3e8b2eacb213d1;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz01?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276u33db-771494bd265e4c97be3e8b2eacb213d1",
        "openingHours": {
          "text": "Mon-Sat: 08:00 - 23:00",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T080000",
            "duration": "PT15H00M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.53051,
          13.4115
        ],
        "distance": 2337,
        "title": "REWE",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Schönhauser Allee 10<br/>10119 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276u33dc-f8d6288526a142d598ad69d3187da0f2;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz02?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276u33dc-f8d6288526a142d598ad69d3187da0f2",
        "openingHours": {
          "text": "Mon-Sat: 08:00 - 23:30",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T080000",
            "duration": "PT15H30M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.51866,
          13.34227
        ],
        "distance": 2613,
        "title": "REWE City",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Bartningallee 3<br/>Hansaviertel, 10557 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276u336z-9ca5d8c0940348739e8b6f36ae55f973;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz03?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276u336z-9ca5d8c0940348739e8b6f36ae55f973",
        "openingHours": {
          "text": "Mon-Sat: 07:00 - 22:00",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T070000",
            "duration": "PT15H00M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.49923,
          13.36233
        ],
        "distance": 2721,
        "title": "REWE City",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Potsdamer Straße 128<br/>Schöneberg, 10783 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-80fed37e7219054ce1c53ab104610624;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz04?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276jx7ps-80fed37e7219054ce1c53ab104610624",
        "openingHours": {
          "text": "Mon-Sat: 07:00 - 22:00",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
            "start": "T070000",
            "duration": "PT15H00M",
            "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
          }]
        },
        "chainIds": [
          "1192"
        ]
      },
      {
        "position": [
          52.53819,
          13.41262
        ],
        "distance": 2884,
        "title": "REWE",
        "averageRating": 0.0,
        "category": {
          "id": "food-drink",
          "title": "Food & Drink",
          "href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
          "type": "urn:nlp-types:category",
          "system": "places"
        },
        "icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
        "vicinity": "Schönhauser Allee 36<br/>Prenzlauer Berg, 10435 Berlin",
        "having": [],
        "type": "urn:nlp-types:place",
        "href": "https://places.cit.api.here.com/places/v1/places/276u33dc-cb9574c5960146b9b30559acf4daf639;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz05?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
        "id": "276u33dc-cb9574c5960146b9b30559acf4daf639",
        "openingHours": {
          "text": "Mon-Fri: 08:00 - 00:00<br/>Sat: 08:00 - 23:00",
          "label": "Opening hours",
          "isOpen": true,
          "structured": [{
              "start": "T080000",
              "duration": "PT16H00M",
              "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR"
            },
            {
              "start": "T080000",
              "duration": "PT15H00M",
              "recurrence": "FREQ:DAILY;BYDAY:SA"
            }
          ]
        },
        "chainIds": [
          "1192"
        ]
      }
    ]
  },
  "search": {
    "context": {
      "location": {
        "position": [
          52.521,
          13.3807
        ],
        "address": {
          "text": "Luisenstraße 35<br/>Mitte, 10117 Berlin<br/>Germany",
          "house": "35",
          "street": "Luisenstraße",
          "postalCode": "10117",
          "district": "Mitte",
          "city": "Berlin",
          "county": "Berlin",
          "stateCode": "Berlin",
          "country": "Germany",
          "countryCode": "DEU"
        }
      },
      "type": "urn:nlp-types:place",
      "href": "https://places.cit.api.here.com/places/v1/places/loc-dmVyc2lvbj0xO3RpdGxlPUx1aXNlbnN0cmElQzMlOUZlKzM1O2xhdD01Mi41MjE7bG9uPTEzLjM4MDc7c3RyZWV0PUx1aXNlbnN0cmElQzMlOUZlO2hvdXNlPTM1O2NpdHk9QmVybGluO3Bvc3RhbENvZGU9MTAxMTc7Y291bnRyeT1ERVU7ZGlzdHJpY3Q9TWl0dGU7c3RhdGVDb2RlPUJlcmxpbjtjb3VudHk9QmVybGluO2NhdGVnb3J5SWQ9YnVpbGRpbmc7c291cmNlU3lzdGVtPWludGVybmFs;context=c2VhcmNoQ29udGV4dD0x?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A"
    },
    "ranking": "chain"
  }
}

我正在尝试提取整个区域中某家商店的所有特许经营权(大约 3000 家),但不知何故我无法获得超过 100 个结果。

有什么解决方案吗?

标签: jsonapimapshere-apihere-maps-rest

解决方案


Places API 是从最终用户客户的角度设计的,并且只为给定类别提供有限数量的结果。对于任何给定的类别,您仍然可以获得100 results(maximum). 您必须将 size 参数设置为size=100一次获得最大(100)个结果。

http://places.demo.api.here.com/places/v1/discover/around?at=52.521%2C13.3807&cat=hotel&size=100&Accept-Language=en-US%2Cen%3Bq%3D0.5&app_id=&app_code=

推荐阅读