api - Where do I retrieve the photo_reference value to make a Google Places Photos request? -


from google's place photos documentation should able retrieve photo_reference key making request nearby search, radar, or place details services.

i'm hitting place details service, , i'm receiving array of photos 10 elements, these elements contain height, width, , html_attribution keys. missing here or has api changed without updating documentation?

here's request place details, place response:

export function placedetailsfetchdata(placeid) {   return (dispatch) => {     const request = { placeid };     const service = new google.maps.places.placesservice(document.createelement('div'));      service.getdetails(request, (place, status) => {       if (status == google.maps.places.placesservicestatus.ok) {         dispatch({           type: place_details_fetch_data_success,           place         });       } else {         dispatch(placedetailshaserrored(true));       }     });   } } 

here's photos value in response:

[   {     "height": 3024,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/109733975839515761188/photos\">chris bair</a>"     ],     "width": 4032   },   {     "height": 2992,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/100217631342523519461/photos\">samir soriano</a>"     ],     "width": 4000   },   {     "height": 453,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/106775786962992563502/photos\">frisco fried</a>"     ],     "width": 604   },   {     "height": 5312,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/111414489430298948350/photos\">tu lam</a>"     ],     "width": 2988   },   {     "height": 1920,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/109551371558914502695/photos\">kenny reed</a>"     ],     "width": 2560   },   {     "height": 4160,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/110844988640416794228/photos\">vicious v</a>"     ],     "width": 3120   },   {     "height": 2576,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/103079141129202103200/photos\">romayne ward</a>"     ],     "width": 1932   },   {     "height": 5312,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/103167182117207780142/photos\">michael c</a>"     ],     "width": 2988   },   {     "height": 1836,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/116997882870097389214/photos\">sam johnson</a>"     ],     "width": 3264   },   {     "height": 4032,     "html_attributions": [       "<a href=\"https://maps.google.com/maps/contrib/113862636441079805689/photos\">wes wu</a>"     ],     "width": 3024   } ] 

the google.maps.places.placephoto object provides method geturl() returns url of place photo. use method url of image, maps javascript api doesn't expose photo reference.

have @ documentation further details:

https://developers.google.com/maps/documentation/javascript/reference#placephoto

place.photos.foreach(function (placephoto) {     var url = placephoto.geturl({         maxwidth: 600,         maxheight: 400     }); }); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -