【问题标题】:Where I can find a place id on google maps我在哪里可以在谷歌地图上找到地点 ID
【发布时间】:2014-07-30 06:57:49
【问题描述】:

我想根据这里的介绍获取地点图片:

https://developers.google.com/places/documentation/details#PlaceDetailsRequests

根据本文档,我需要该地点的“地点 ID”。

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&key=AddYourOwnKeyHere

在哪里可以找到placeid

【问题讨论】:

    标签: javascript google-maps google-places-api


    【解决方案1】:

    您应该可以在此处找到地点 ID: https://developers.google.com/places/place-id#find-id

    【讨论】:

      【解决方案2】:

      place_id 位于SearchResults 中,来自任何SearchRequests

      来自the documentation

      {
         "html_attributions" : [],
         "results" : [
            {
               "geometry" : {
                  "location" : {
                     "lat" : -33.870775,
                     "lng" : 151.199025
                  }
               },
               "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/travel_agent-71.png",
               "id" : "21a0b251c9b8392186142c798263e289fe45b4aa",
               "name" : "Rhythmboat Cruises",
               "opening_hours" : {
                  "open_now" : true
               },
               "photos" : [
                  {
                     "height" : 270,
                     "html_attributions" : [],
                     "photo_reference" : "CnRnAAAAF-LjFR1ZV93eawe1cU_3QNMCNmaGkowY7CnOf-kcNmPhNnPEG9W979jOuJJ1sGr75rhD5hqKzjD8vbMbSsRnq_Ni3ZIGfY6hKWmsOf3qHKJInkm4h55lzvLAXJVc-Rr4kI9O1tmIblblUpg2oqoq8RIQRMQJhFsTr5s9haxQ07EQHxoUO0ICubVFGYfJiMUPor1GnIWb5i8",
                     "width" : 519
                  }
               ],
               "place_id" : "ChIJyWEHuEmuEmsRm9hTkapTCrk",  // <----------------------------------------------
               "scope" : "GOOGLE",
               "alt_ids" : [
                  {
                     "place_id" : "D9iJyWEHuEmuEmsRm9hTkapTCrk",
                     "scope" : "APP"
                  }
               ],
      

      【讨论】:

        【解决方案3】:

        上述解决方案在大多数情况下都有效,但当您有一些个人使用与企业相同的地址时,有时会失败。如果您已经用尽了 Google 文档Herehere 中提供的 API 和手动搜索选项

        您可以使用此页面提供的手动建议,它一直对我有用https://www.launch2success.com/guide/cant-find-google-places-id-trick-finding-google-places-id/

        【讨论】:

        • 链接已损坏。
        • 即使在 google 工具找不到地点 id 的情况下,此方法也有效
        【解决方案4】:

        您可能需要通过搜索地点名称来获得地点 ID Text search

        您的示例请求可能如下所示

        https://maps.googleapis.com/maps/api/place/textsearch/json?query=fish+market+sydney&key="YOUR_API_KEY"

        您会在返回的 JSON 字符串中找到“place_id”。

        【讨论】:

          【解决方案5】:

          也许可以试试TextSeach 选项,或者试试我在下面提到的Nearbysearch 选项,也许它对你有用。

          1.https://maps.googleapis.com/maps/api/place/nearbysearch/json?query={address}&key={_apiConfig.Key}

          2.https://maps.googleapis.com/maps/api/place/textsearch/json?query={address}&key={_apiConfig.Key}

          作为回应,您将获得所有带有地点 ID 的信息。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多