-2

I am not sure if I'm understanding Google Place API correctly. It seems that first I need to get all places around my latitude and longitude like this:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?
location=42.150527,24.746477&radius=1500&type=museum&key=

This returns a list with locations. One of the properties is called placeid and I need to make another request with placeid in order to get all the information about that specific location like this:

https://maps.googleapis.com/maps/api/place/details/json?
placeid=ChIJsxASe6LRrBQRzyglri0l8vI&&key=

These details contain a property called photos which contains the photo_reference of the images related to that location.

Finally I must do a third call with photoreference to get the actual images using this:

https://maps.googleapis.com/maps/api/place/photo?
photoreference=CmRaAAAAwfDNJ58gt4t3v-
9t6hldrzCk_eiIKtYTnOE_VOj87qGAwzKO_-3qV78A4loe7Mflu5AA8FP_ImR6ZZ8Jxj1PRUW0FAcdBp
0FuTJd5qu9nkrZRqWWhB5yO-
4CbvBHm30REhBxvu55Dbo1WBpi61hvsBQvGhSjB2tQQQUYV4dX_mZluz5d8xLg4w&key=

Wouldn't this mean that I'd have to make loads of request if I want to get all images for a specific location. If I want 5 images, I'd have to make 5 requests, wouldn't I?

Onyx
  • 5,186
  • 8
  • 39
  • 86

1 Answers1

0

The Nearby Search requests also returns a single photo reference per place, when relevant. You may skip the Place Details request and call the Place Photo request for the results returned by the Nearby Search. You may visit the documentation of Place Photos for more information.

Shawn Domingo
  • 1,371
  • 1
  • 11
  • 16