Pulling Google's location image from Places API

Is it possible to get the Google image from the Places API? I notice that the Google icon is available but not the actual image that represents the location. If it isn’t possible, is anyone familiar with an efficient workaround? Thanks!

No, the image is not returned. The PlaceId is … which is the key to the image request.

Thank you, Nigel. How would one go about using the ID to fetch the image?

Ah, now that is the question :slightly_smiling:

Ha! Nigel giveth, Nigel taketh away

If I had to guess I would think that the image is accessible via Google’s street view image API. Perhaps the Google ID could be passed along to retrieve the image.

Using the PlaceId you can do a GetPlaceDetails. PlaceDetails returns Photoreference. That can be used to get the Photo.

Easy enough in PostMan…how all that comes back if you integrated it into Blockspring or Zapier… I have no idea.

Good documentation here Place Photos  |  Places API  |  Google for Developers

1 Like

Thanks, Nigel. I’ll definitely see where I can get with this approach.

Great :slight_smile:

I am also interested in how to do it, but won’t get there for a few days. Will keep you posted.

I am able to get to the photorefernce response but I am not ble to display the photo. I have a repeating group with several place IDs. I get the photorefernce response but using it as the source for an image does not work or source for HTML does not work. What Visual Element will display the photo from a photoreference in a repeating group?

This might help.

1 Like

NigelG,
Thanks for this “general” advice, that by the way you spread in many forum items, but I think we are trying to build such process with Bubble on this forum, so it would be I think more helpfull to indicate us how to do such workflow in Bubble. I have tried using the custom API to mimicate your built-in Google Place API, but this is a pain and I haven’t figured it out.

Wouldn’t it be much MUCH more easy if you would return the “photos” field from the Google API response in your Bubble built-in Google Places API, exactly like the other fields “place_id” etc ? I don’t understand why you removed such fields from the response, but that would be very useful I think.

Thanks a lot for your answer,
Best,
Nicolas

image

3 Likes

:wink: Sorry if that was not clear, let me try to do it again:

However, this requires the photoreference id, which you have to get from another GET request:

https://maps.googleapis.com/maps/api/place/textsearch/json?query=123+main+street&key=

The result being located in the “photos” field of the response:
(https://developers.google.com/places/web-service/search#PlaceSearchResults)

So, this requires to make 2 sequential requests.

With Bubble, as it I seems the “Google Places” plugin does not provide the “photos” field unfortunately (the only fields I can access are: “Name”, “Address”, “Postal address”, “Icon”, “Open now”, “Types”, “Id”, “Place ID”, “Permanently Closed”), I tried to mimicate this plugin, using the “API Connector” plugin, and setting up the Google API Get request, to be able to make the 2 above requests. Unfortunately, I got stuck at some point, and I don’t know how to easily trigger the 2nd request after the 1st one.

So to sum up, my first question would be the following: in the “Google Places” plugin, how can we access the “photos” response field in addition of the others (“Name”, “Address”, “Postal address”, “Icon”, “Open now”, “Types”, “Id”, “Place ID”, “Permanently Closed”)? If not possible yet, could you add this feature please ? That would be extremely helpfull for me, and I think the most simple solution.

Is that more clear ? Sorry if I seemed a bit frustrated in my earlier post, but the thing is that I am very motivated to use Bubble for my project, but I have been stuck on the first feature I wanted to implement: make a search for google places, and get a picture for each of them, which I thought would be one of the most basic use cases.

Thanks a lot for your help.
Best,
Nicolas

Hi there,

I don’t work for Bubble I am afraid.

However, if you use the Airdev Google Places Plugin, then they are pulling back the Photo References as part of the Place call.

You can then directly code the photo reference into the Image URL.

https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRtAAAATLZNl354RwP_9UKbQ_5Psy40texXePv4oAlgP4qNEkdIrkyse7rPXYGd9D_Uj1rVsQdWT4oRz4QrYAJNpFX7rzqqMlZw2h2E2y5IKMUZ7ouD_SlcHxYq1yL4KbKUv3qtWgTK0A6QbGh87GB3sscrHRIQiG2RrmU_jF4tENr9wGS_YxoUSSDrYjWmrNfeEHSGSc3FyhNLlBU&key=blahblah

You can see it working here …

That does leave your Google places API key in the wild, but you can always create one specially and limit the URLs. There are probably other ways of obfuscating it as well.

1 Like

Hi again,

Ok sorry I though you were a Bubble team member :slight_smile:

Thanks a lot, the AirDev Google Places plugin indeed allowed me to retrieve directly the photos field!

There is only a problem when trying to display the results from this plugin onto a map, since a map only accepts “geographic address” to work it seems. I am afraid only the Bubble guys can do this transformation (turn the api response coordinates into a geographic address type), but if you have any idea that would be awesome.

Best,
Nicolas

1 Like

Element / Dynamic Data / Calculate Formula / Co-ordinates to Address

1 Like

Thanks for posting this. Helped me out almost two years later!

1 Like