Place Photos

The Place Photo service, part of the Places API, is a read- only API that allows you to add high quality photographic content to your application. The Place Photo service gives you access to the millions of photos stored in the Places database. When you get place information using a Place Details request, photo references will be returned for relevant photographic content. Find Place, Nearby Search, and Text Search requests also return a single photo reference per place, when relevant. Using the Photo service you can then access the referenced photos and resize the image to the optimal size for your application.

Photo References

All requests to the Place Photo service must include a photoreference, returned in the response to a Find Place, Nearby Search, Text Search, or Place Details request. The response to these requests will contain a photos[] field if the place has related photographic content.

Note: The number of photos returned varies by request.

  • A Find Place, Nearby Search, or Text Search request returns at most one photo element in the array.
  • A Place Details request returns up to ten photo elements.

Each photo element will contain the following fields:

  • photo_reference — a string used to identify the photo when you perform a Photo request.
  • height — the maximum height of the image.
  • width — the maximum width of the image.
  • html_attributions[] — contains any required attributions. This field will always be present, but may be empty.

Photos returned by the Photo service are sourced from a variety of locations, including business owners and user contributed photos. In most cases, these photos can be used without attribution, or will have the required attribution included as a part of the image. However, if the returned photo element includes a value in the html_attributions field, you will have to include the additional attribution in your application wherever you display the image.

An example of a photos[] array is shown below.

"photos" : [
      "html_attributions" : [],
      "height" : 853,
      "width" : 1280,
      "photo_reference" : "CnRvAAAAwMpdHeWlXl-lH0vp7lez4znKPIWSWvgvZFISdKx45AwJVP1Qp37YOrH7sqHMJ8C-vBDC546decipPHchJhHZL94RcTUfPa1jWzo-rSHaTlbNtjh-N68RkcToUCuY9v2HNpo5mziqkir37WU8FJEqVBIQ4k938TI3e7bf8xq-uwDZcxoUbO_ZJzPxremiQurAYzCTwRhE_V0"

Place Photo Requests

A Place Photo request is an HTTP URL of the following form:

Certain parameters are required to initiate a search request. As is standard in URLs, all parameters are separated using the ampersand (&) character. The list of parameters and their possible values are enumerated below.

Required parameters

  • key — Your application's API key. This key identifies your application for purposes of quota management. See Get a key for more information.
  • photoreference — A string identifier that uniquely identifies a photo. Photo references are returned from either a Place Search or Place Details request.
  • maxheight or maxwidth — Specifies the maximum desired height or width, in pixels, of the image returned by the Place Photos service. If the image is smaller than the values specified, the original image will be returned. If the image is larger in either dimension, it will be scaled to match the smaller of the two dimensions, restricted to its original aspect ratio. Both the maxheight and maxwidth properties accept an integer between 1 and 1600.

An example request is shown below. This request will return the referenced image, resizing it so that it is at most 400 pixels wide.

Place Photo Response

The response of a successful Place Photo request will be an image. The type of the image will depend upon the type of the originally submitted photo.

If your request exceeds your available quota, the server will return an HTTP 403 status and display the below image to indicate that the quota has been exceeded:

Over Quota image

If the server is unable to understand your request, then it returns HTTP 400 status, which indicates an invalid request. The most common reasons for an invalid request include:

  • The submitted photo reference was not correctly specified.
  • The request did not include either the maxwidth or the maxheight parameters.
  • The value for either the maxwidth or the maxheight parameter was set to null.

Error Messages

When the Places service returns an HTTP 400 status, there may be an additional error_message field within the response object containing more detailed information about the reasons behind the status code. This field is not always returned, and its content is subject to change.

Info Messages

When the Google Places service returns additional information about the request specification, there may be an additional info_messages field within the search response object. This field is only returned for successful requests. It may not always be returned, and its content is subject to change.

The sensor Parameter

The Places API previously required that you include the sensor parameter to indicate whether your application used a sensor to determine the user's location. This parameter is no longer required.