Photos of particular place id

How I can get all the pictures of a particular "place_id"?

When I retrieve the list of "places" in a particular location I have only access to one particular image "photo_reference".

I want to show the details of place through its "places_id" (more specific search), but the result of the API function no associated picture appears. If you're looking through places that google places "id" concrete many more images appear. How I can recover them?

Thanks

Answers


You can use the street view image API when the places API doesn't return any photos. You can use the coordinates you receive from the places response in the request to the street view API to a link something like this:

https://maps.googleapis.com/maps/api/streetview?size=600x300&location=46.414382,10.013988&key=YOUR_API_KEY

You probably need to enable the street view api in the google developers console along with your places api.

Street view reference: https://developers.google.com/maps/documentation/streetview/?hl=en

Assuming you have an element with an id of attributions and an element with id of image you could do the following with the JavaScript API. Codepen: http://codepen.io/anon/pen/adooRp

  var attributions = document.getElementById("attributions");   
  var service = new google.maps.places.PlacesService(attributions);

  var request = {
      placeId: 'ChIJ10KlwAdzXg0RsH56kZsfcHs'   
  };

  service.getDetails(request, function(place, status) {
      if (status == google.maps.places.PlacesServiceStatus.OK) {
          var lat = place.geometry.location.lat();
          var lng = place.geometry.location.lng();

          var src = "https://maps.googleapis.com/maps/api/streetview?size=600x300&location="
+ lat + "," + lng + "&key=YOUR_API_KEY_HERE";

          document.getElementById("image").src = src;

      }   
  });

Need Your Help

Any way to get widget-id for twitter widget from Twitter url?

javascript html twitter

Is there any way to find twitter widget id from twitter url?

AJAX FormData Post - 503 Service Unavailable

php jquery ajax form-data

I've searched extensively on this problem without avail or maybe I'm missing the issue. Please, relay to me anything I could do to improve on the explanation.