2012-12-05 122 views
2

我看到來自google地點的json響應返回一個字段photo_reference。有誰知道如何獲得相關的圖像?來自Google Places Api的Photo_reference

"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", 
     "id" : "320d77fa60610f618058bd58b8ba46e340c615b8", 
     "name" : "The Meat & Wine Co", 
     "opening_hours" : { 
      "open_now" : true 
     }, 
     "photos" : [ 
      { 
       "height" : 968, 
       "html_attributions" : [], 
       "photo_reference" : "CoQBeQAAAAgOdveT3dRtzoJ42BTBZfCdZptWsqLN3bROkP4FVHNNX-qjxBiw0vdGpDaX_lVb3rcaQf5hBVvrEdMUMDKB2gcsIOaVNII_zLvY-5Kf4rOuTXElOgSHb5vxJoB-o70Oh0Bs-zxxUpHM0Ji_BPk2RpXoKdf8jG_QLPaulXWoC7TcEhDSLjj-4_l3hJpD0W_qBtoMGhT1MK1GRVFH1dnJolimMP7Z8a2tZA", 
       "width" : 1296 
      } 
     ], 
     "rating" : 3.90, 
+0

選中此http://stackoverflow.com/questions/13524834插值photo_reference值/ google-place-api-placedetails-photo-reference/13774957#13774957 –

回答

2

我一直在想同樣的事情。我閱讀了有關Picasa API的內容,這看起來像是這些圖像的邏輯存儲位置。

已更新2013年3月13日

此功能已發佈的Places API的一部分。請參閱文檔鏈接。​​3210

+0

有沒有辦法得到這些數據? –

2

谷歌還提供照片的地方使用API​​ photo_reference檢索從谷歌地圖照片

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

鍵: - 在這裏通過你的應用程序API密鑰。

maxwidth & maxheight: - 所需的最大高度或寬度時,它會通過API返回

photoreference: - 在這裏通過你的照片參考。

發送請求到這個api。它會返回你的形象。

圖片類型將取決於最初提交的照片的類型。

更多信息轉到: -​​3210

0

在HTML img標籤

var photo_reference_goes_here = ['icon']['photos'][0]['photo_reference']

<img class="rig-img" src="https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=photo_reference_goes_here&key=GOOGLE_KEY" alt="Pic From Google">