-1
我試圖找到附近的地方使用谷歌nearbyAPI,其工作如預期。但是,問題是我無法從json響應中獲取地點圖像。請看下面的代碼。如何從谷歌附近的搜索API
{
"geometry": {
"location": {
"lat": 24.331058,
"lng": 54.623759
},
"viewport": {
"northeast": {
"lat": 24.332406980291,
"lng": 54.625107980292
},
"southwest": {
"lat": 24.329709019708,
"lng": 54.622410019708
}
}
},
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
"id": "6c79339941d125d001a2116834f3257346b150bd",
"name": "Mafraq Hotel & Resort",
"photos": [{
"height": 4032,
"html_attributions": [
"<a href=\"https://maps.google.com/maps/contrib/100504071164796744561/photos\">ناصر الكعبي</a>"
],
"photo_reference": "CoQBdwAAAF_hJoCjWHzDXpfEWbS-Ubg3cPB1Eac2y7fy6HM0q1sb4TyOZdci4LUQi7Z8TYXVw-ZbjeSDXkg-wwHjr67Ib2Aluv5QChRl3C97gTmlseV7UpUnvyW3Vt4GmcyQGRhfEkhjimbqjkUE8qC-8dt7thsRXzw7TIaBrEii1wK5C7gUEhCfuLSsZdEZkgoMEy0luSyeGhTfNMKnTkqmzUlUtTwdO7Gwx8tDYQ",
"width": 3024
}],
"place_id": "ChIJbURih5o3Xj4R4qP2Jcu8C8k",
"rating": 3.9,
"reference": "CmRSAAAAMdmAyoaneUbzSmqHVbG_SFpgdcRjKSxQcHmVLKO518kINmhukPJF5Qo8tju2Su7uekMOXRw5jJxiNbBzjHY7Cd72FjnYEbx87N2F3OZoAUfUC9XuJ52uJmiJtXKRk9SkEhAg9HLkwuO58r4iVvgBqnY8GhTVfRwqPvEULqLIqmYlyA3U6h_1pg",
"scope": "GOOGLE",
"types": [
"gym",
"lodging",
"health",
"restaurant",
"food",
"point_of_interest",
"establishment"
],
"vicinity": "Sheikh Maktoum Bin Rashid Road, Al Mafraq"
}
我得到一個照片陣列:
"photos": [{
"height": 4032,
"html_attributions": [
"<a href=\"https://maps.google.com/maps/contrib/100504071164796744561/photos\">ناصر الكعبي</a>"
],
"photo_reference": "CoQBdwAAAF_hJoCjWHzDXpfEWbS-Ubg3cPB1Eac2y7fy6HM0q1sb4TyOZdci4LUQi7Z8TYXVw-ZbjeSDXkg-wwHjr67Ib2Aluv5QChRl3C97gTmlseV7UpUnvyW3Vt4GmcyQGRhfEkhjimbqjkUE8qC-8dt7thsRXzw7TIaBrEii1wK5C7gUEhCfuLSsZdEZkgoMEy0luSyeGhTfNMKnTkqmzUlUtTwdO7Gwx8tDYQ",
"width": 3024
}],
但是,我不知道我怎樣才能從這個陣列信息創建的圖像。 (我正在與網頁api和我需要的圖像網址)
任何幫助,真的不勝感激。
由於提前
如果我按照[地方照片文件]中的說明( https://developers.google.com/places/web-service/photos),我得到一個顯示圖片的圖片網址。你如何試圖顯示圖像? – geocodezip