Google地图照片不显示图片

时间:2017-09-01 08:15:02

标签: android google-maps google-maps-api-3 retrofit android-glide

我正试图从我所在城市的餐馆拍照。

这是其中一家餐厅的结果。

{
     "formatted_address" : "Oranjesingel 2C, 6511 NS Nijmegen, Netherlands",
     "geometry" : {
        "location" : {
           "lat" : 51.8422931,
           "lng" : 5.8626707
        },
        "viewport" : {
           "northeast" : {
              "lat" : 51.8435754802915,
              "lng" : 5.864029830291503
           },
           "southwest" : {
              "lat" : 51.8408775197085,
              "lng" : 5.861331869708498
           }
        }
     },
     "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
     "id" : "8ccec67db5bcfdf6d1834c5a7ef3e23a20ca10e1",
     "name" : "MANNA Nijmegen",
     "opening_hours" : {
        "open_now" : true,
        "weekday_text" : []
     },
     "photos" : [
        {
           "height" : 1182,
           "html_attributions" : [
              "\u003ca href=\"https://maps.google.com/maps/contrib/113695304522183603442/photos\"\u003eMANNA Nijmegen\u003c/a\u003e"
           ],
           "photo_reference" : "CmRaAAAA8FoXKUNAFzfqC0eLyW9bif0NkwG68fX6RYOMsS_LHljLMQburGeS5ZdepIz48zPthQA4r1DLwFd8bcSOsgdylYdREY-ba8I0VZvh0_m1BCX-vFNh3LtN61Y9HCX9lCVjEhBXj67s7Qb_OLnlNd6TrvFfGhT47VdxeE8zFKbYkqge9IlC5jtepg",
           "width" : 2660
        }
     ],
     "place_id" : "ChIJAeG2ZlsIx0cRP0JpZPZNGr0",
     "rating" : 4.4,
     "reference" : "CmRSAAAAraBcK51UuB6Sh4HWKIth4_dqJJyrX6MCqoNhocN7DnbIdqqjMZvRsXM088hfFOUC2inrnNJRiIq4EWDVQtfP7b7QlcFWzMVysKQvPlalo6GiqRdMTcXAPA4pmmui0xQfEhDm3DzwNDvh9zBpDnf518VsGhQsBn6svBocV4VdzNyosm3dYf-CAA",
     "types" : [
        "restaurant",
        "bar",
        "lodging",
        "food",
        "point_of_interest",
        "establishment"
     ]
  }

就像你可以看到有一个photo_reference。当我继续尝试将此photo_reference插入此链接时:

https://maps.googleapis.com/maps/api/place/photo?photoreference=PHOTO_REFERENCE&key=KEY

它会给我403图片。我已通过此链接检查我的密钥是否有效,该链接位于Google Maps API网站上。

https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRtAAAATLZNl354RwP_9UKbQ_5Psy40texXePv4oAlgP4qNEkdIrkyse7rPXYGd9D_Uj1rVsQdWT4oRz4QrYAJNpFX7rzqqMlZw2h2E2y5IKMUZ7ouD_SlcHxYq1yL4KbKUv3qtWgTK0A6QbGh87GB3sscrHRIQiG2RrmU_jF4tENr9wGS_YxoUSSDrYjWmrNfeEHSGSc3FyhNLlBU&key=YOUR_API_KEY

我还尝试过我的结果集中其他餐馆的不同照片参考。我究竟做错了什么?或者这是一个错误吗?

1 个答案:

答案 0 :(得分:1)

当我从您的示例中打开带有photo_reference的链接时

CmRaAAAA8FoXKUNAFzfqC0eLyW9bif0NkwG68fX6RYOMsS_LHljLMQburGeS5ZdepIz48zPthQA4r1DLwFd8bcSOsgdylYdREY-ba8I0VZvh0_m1BCX-vFNh3LtN61Y9HCX9lCVjEhBXj67s7Qb_OLnlNd6TrvFfGhT47VdxeE8zFKbYkqge9IlC5jtepg

我看到了这个

Google Places API Web Service

HTTP 302,然后是HTTP 200.问题是否可以重定向?