Google place Api PlaceDetails Photo Reference

I am using Google Place Api where is on some results "photo_reference" (similar to "reference") value. I cannot find any mention about that how to use it to get that photo. I know how to use "reference" to get PlaceDetail and I am sure that usage of photo_reference will be similar, but I cannot find JSON/XML URL for this photo_reference request. Thank you for any help. Pavel


Place Details | Places API, Using the PlaceId you can do a GetPlaceDetails. PlaceDetails returns Photoreference. That can be used to get the Photo. The Place Photo service gives you access to the millions of photos stored in the Places database. When you get place information using a Place Details request, photo references will be returned for


The Places API now supports the return of one place photo if available for a Place Search request and up to ten place photos for a Place Details request.

If a photos array is returned with your request, you can pass the photo_reference from a contained photo object to a Place Photo request with the maxheight and/or maxwidth, sensor and key parameters:

https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRvAAAAwMpdHeWlXl-lH0vp7lez4znKPIWSWvgvZFISdKx45AwJVP1Qp37YOrH7sqHMJ8C-vBDC546decipPHchJhHZL94RcTUfPa1jWzo-rSHaTlbNtjh-N68RkcToUCuY9v2HNpo5mziqkir37WU8FJEqVBIQ4k938TI3e7bf8xq-uwDZcxoUbO_ZJzPxremiQurAYzCTwRhE_V0&sensor=false&key=AddYourOwnKeyHere

Please see the documentation for more details.

Google place Api PlaceDetails Photo Reference, I used the photo_reference to retrieve the actual photo through Google Place photo api call. Then I get the binary text of the image which is the� A Place Details request may return up to ten photos. More information about place photos and how you can use the images in your application can be found in the Place Photos documentation. A photo


After initiating map you can get place details with it's images

const service = new window.google.maps.places.PlacesService(map);
service.getDetails(
  {
    placeId: "some_place_id_here"
  },
  (data, status) => {
    if (status === window.google.maps.places.PlacesServiceStatus.OK) {
      data.photos &&
        data.photos.forEach(photo => {
          console.log(photo.getUrl({ maxWidth: 500, maxHeight: 500 }));
        });
    }
  }
);

Pulling Google's location image from Places API, In this episode we'll see how to use place details returned from a Google places API location Duration: 19:52 Posted: Nov 5, 2019 From Google's Place Photos documentation I should be able to retrieve a photo_reference key from making a request to their nearby search, radar, or place details services.


Step 1: The URL you should use to call Google Place Photos is :

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

Refer: https://developers.google.com/places/web-service/photos

Step 2: Since the above URL redirects to another URL, use HTTPClient, as it automatically handles redirect stuff.

Code:

DefaultHttpClient hc = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
HttpContext context = new BasicHttpContext();
hc.setRedirectHandler(new DefaultRedirectHandler() {
 @Override
 public URI getLocationURI(HttpResponse response,
 HttpContext context) throws org.apache.http.ProtocolException {

  //Capture the Location header here - This is your redirected URL
  System.out.println(Arrays.toString(response.getHeaders("Location")));

  return super.getLocationURI(response,context);

  }
 });

 // Response contains the image you want. If you test the redirect URL in a browser or REST CLIENT you can see it's data
 HttpResponse response = hc.execute(httpget, context);
 if(response.getStatusLine().getStatusCode() == 200) {
   // Todo: use the Image response 
   HttpEntity entity = response.getEntity();
   if (entity != null) {
     InputStream instream = entity.getContent();
     Bitmap bmp = BitmapFactory.decodeStream(instream);         
     ImageView imageView = new ImageView(context);
     imageView.setImageBitmap(bmp);
     images.add(imageView);
     instream.close();
  }                 
 }
 else {
   System.out.println(response.getStatusLine().getStatusCode()+"");
 }

Hope this helps everyone.

[Google Maps Library] Google place photo, @ebouJ - you used web sdk of google maps API? can you share some example of placeID; let placeDetails = await fetch( var locationimage = { uri: 'https:// maps.googleapis.com/maps/api/place/photo?photoreference=${� Browse other questions tagged google-maps-api-3 google-places-api or ask your own question. Blog Last minute gift ideas for the programmer in your life


(Ep 31) Display Location Image Using Google Places Photo API , I am using Google Place Api where is on some results "photo_reference" (similar to "reference") value. I cannot find any mention about that how to use it to get� Place data fields define the types of Place data to return when requesting Place Details. This page lists all place data fields, and explains how they are supported for each API/SDK (support for place fields varies by platform and/or feature). For more information about how Place Details requests are billed, see Usage and Billing.


Product Changes | Google Maps Platform, com.google.maps. String photoReference). Requests a Photo from a PhotoReference. Creates a new Places Autocomplete request for a given input . public static PlaceDetailsRequest placeDetails(GeoApiContext context, java .lang. The Place Photo feature allows you to add high quality photographic content to your site. The Photo service gives you access to the millions of photos stored in the Places and Google+ Local


Places details and photos ? � Issue #106 � tolu360/react-native , Connect your app or website users to over 100 million points of interests with Places, using Autocomplete, Geocoding & Place Search APIs.