Google place Api PlaceDetails Photo Reference

Pavel picture Pavel · Nov 23, 2012 · Viewed 30.1k times · Source

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

Answer

Pavel Kostenko picture Pavel Kostenko · Dec 8, 2012

Please take a look at documentation here: https://developers.google.com/places/documentation/photos

They've just announced this new Place Photos feature

In short this is how you should use this new feature:

https://maps.googleapis.com/maps/api/place/photo?photoreference=PHOTO_REFERENCE&sensor=false&maxheight=MAX_HEIGHT&maxwidth=MAX_WIDTH&key=YOUR_API_KEY

just substitute your own values in place of:

  • PHOTO_REFERENCE
  • MAX_HEIGHT - int value from 1 to 1600
  • MAX_WIDTH - int value from 1 to 1600
  • YOUR_API_KEY

and you are done