Search for a Place and Assemble a Place Card
A 3-step recipe with Google Maps Platform. We can help you get access.
Recipe · 3 steps
Search for a Place and Assemble a Place Card
with Google Maps Platform
Go from a natural-language query to a detailed place plus a renderable photo URI.
- Search for places matching the natural-language query, ranked by relevance and filtered to places currently open at or above the minimum rating.
- Read the full record for the top candidate. This is where the fields a cost-conscious search mask omitted - opening hours, website, editorial summary, full photo list - are actually paid for and returned.
- Resolve a photo into a short-lived URI. skipHttpRedirect is set so the response is a JSON body carrying photoUri rather than a redirect to image bytes, which lets a caller cache or proxy the image itself.
What you'll need to have ready
- textQuery: The natural-language query to search for (e.g. "pizza in New York").
- photoReference: The trailing photoReference segment of a photo resource name. Place Details returns photo resource names in the form places/{placeId}/photos/{photoReference}; t
- searchFieldMask: Comma-separated fields for the text search response. Search field masks are prefixed with "places." because results are nested under that key.
- detailsFieldMask: Comma-separated fields for the Place Details response. Details masks are unprefixed because the response is a single Place object.
- languageCode: BCP-47 language code for results (e.g. "en").
- regionCode: CLDR region code used to bias results (e.g. "US").
- maxResultCount: Maximum number of search results to return (1-20).
- minRating: Only return places rated at least this highly (0.0-5.0).
- maxWidthPx: Maximum width of the returned photo in pixels (1-4800).
For your developer
Arazzo workflow google-maps:place-search-to-photo, 3 operations: searchPlacesText → getPlaceDetails → getPlacePhoto. Specs on APIs.io.