Introduction
The Street View Static API metadata requests provide data about Street View panoramas. Using the metadata, you can find out if a Street View image is available at a given location, as well as getting programmatic access to the latitude and longitude coordinates, the panorama ID, the date the photo was taken, and the copyright information for the image. Accessing this metadata lets you customize error behavior in your application.
Street View Static API metadata requests are available at no charge. No quota is consumed when you request metadata. Quota is only consumed when you load an image using the Street View Static API.
When making Street View imagery metadata requests, the panorama imagery is accurate to 50 meters.
Access the imagery metadata
A Street View image metadata request is an HTTP URL of the following form:
https://maps.googleapis.com/maps/api/streetview/metadata?parameters
As is standard in URLs, all parameters are separated using the ampersand (&) character.
Required parameters for metadata requests
The metadata requests accept the same URL parameters as the Street View Static API imagery requests, although only the following parameters are required:
Either:
location
— can be either a text string (such asChagrin Falls, OH
) or a comma-separated pair of latitude and longitude coordinates (40.457375,-80.009353
).
Or:
pano
— a specific panorama ID. Panoramas may change IDs over time, so don't persist this ID. Instead, save the location address or latitude and longitude coordinates so you can refresh the panorama ID. For details, see Refresh deleted panorama IDs.
As well as:
key
andsignature
— the API key is required to authenticate the request. The digital signature is also required in certain instances, and always recommended. For more information, see Get a Key and Signature.
Your metadata request, with only required parameters, looks like this:
https://maps.googleapis.com/maps/api/streetview/metadata?location=&key=YOUR_API_KEY&signature=
or like this:
https://maps.googleapis.com/maps/api/streetview/metadata?pano=&key=YOUR_API_KEY&signature=
Refresh deleted panorama IDs
If you attempt to retrieve a panorama ID and get either ZERO_RESULTS
or
no value, then the panorama ID has been deleted and needs to be refreshed.
Save the location address or latitude and longitude coordinates you used to get a panorama ID so you can refresh when needed.
When you detect that a panorama ID has changed, use the original location address or latitude and longitude coordinates to search again for the nearest panoramas to that location and get a new panorama ID.
Optional parameters for metadata requests
You can include the following parameters in your metadata request: size
,
heading
, fov
, and pitch
. Note that these parameters don't influence
the data about the panorama, or which panorama is found.
The API allows the inclusion of the same parameters as the
imagery request
to make it easier to construct a metadata request related to a specific imagery
request, but for metadata requests, the API ignores the optional parameters and
their values. For information about using these parameters, see the
Street View Static API developer's guide.
Response format
Metadata responses are returned in JSON format only.
Examples
Example 1: Panorama found
The following URLs successfully request the metadata and image of the same panorama.
Metadata request and response
https://maps.googleapis.com/maps/api/streetview/metadata?size=600x300&location=eiffel%20tower,%20paris,%20france&heading=-45&pitch=42&fov=110&key=YOUR_API_KEY&signature=YOUR_SIGNATURE
{ "copyright" : "© 2017 Google", "date" : "2016-05", "location" : { "lat" : 48.85783227207914, "lng" : 2.295226175151347 }, "pano_id" : "tu510ie_z4ptBZYo2BGEJg", "status" : "OK" }
Imagery request and response, where the missing image is expected.
https://maps.googleapis.com/maps/api/streetview?size=600x300&location=eiffel%20tower,%20paris,%20france&heading=-45&pitch=42&fov=110&key=YOUR_API_KEY&signature=YOUR_SIGNATURE
Example 2: Panorama not found
The following URLs request the metadata and image for a panorama that couldn't be found at or near the specified location.
Metadata request and response
https://maps.googleapis.com/maps/api/streetview/metadata?size=600x300&location=78.648401,14.194336&fov=90&heading=235&pitch=10&key=YOUR_API_KEY&signature=YOUR_SIGNATURE
{ "status" : "ZERO_RESULTS" }
Imagery request and response
https://maps.googleapis.com/maps/api/streetview?size=600x300&location=78.648401,14.194336&fov=90&heading=235&pitch=10&key=YOUR_API_KEY&signature=YOUR_SIGNATURE
Status codes
The status
field within the metadata response object contains the status of
the request, and may contain debugging information to help you troubleshoot
why the Street View request is not working. The status
field may contain
the following values:
Status | Description |
---|---|
"OK" |
Indicates that no errors occurred; a panorama is found and metadata is returned. |
"ZERO_RESULTS" |
Indicates that no panorama could be found near the provided location. This response can occur if you provide a non-existent or invalid panorama ID. See [Refresh deleted panorama IDs](#refresh-pano). |
"NOT_FOUND" |
Indicates that the address string provided in the location
parameter couldn't be found. This message may occur if a non-existent address
is given. |
"OVER_QUERY_LIMIT" |
Indicates that you have exceeded your daily quota or per-second quota for this API. |
"REQUEST_DENIED" |
Indicates that your request was denied. This message may occur if you did not authorize your request, or if the Street View Static API is not activated in the Google Cloud Console project containing your API key. |
"INVALID_REQUEST" |
Generally indicates that the query parameters (address, latitude and longitude coordinates, or components) are missing. |
"UNKNOWN_ERROR" |
Indicates that the request couldn't be processed due to a server error. This issue is often temporary. The request may succeed if you try again. |
More information
For more information on using the Street View Static API, or other Google Maps API products, be sure to check out the Maps API Support page.