<iframe src="https://developers.devsite.google/frame/maps/documentation/javascript/reference/street-view-service_06f7a3f47539e990f78a33295aec0cdbfec644bfe584aace9e73f7c9532f1668.frame" class="framebox inherit-locale redirect-iframe" allow="clipboard-write https://developers.devsite.google" allowfullscreen is-upgraded></iframe>

## [StreetViewService](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewService)
class


class
`google.maps.StreetViewService`

library `"streetView"`

A `StreetViewService` object performs searches for Street View data.

```javascript
const {StreetViewService} = await google.maps.importLibrary("streetView");
```

| ### Constructor ||
|---|---|
| `StreetViewService` | `StreetViewService()` **Parameters:** None Creates a `StreetViewService`, which provides an interface to the data stored in the Street View service. |

| ### Methods ||
|---|---|
| `getPanorama` | `getPanorama(request[, callback])` **Parameters:** - `request: StreetViewLocationRequest|StreetViewPanoRequest` - `callback: function(StreetViewPanoramaData optional, StreetViewStatus): void optional` **Return Value:** `Promise<StreetViewResponse>` Retrieves the `StreetViewPanoramaData` for a panorama that matches the supplied Street View query request. The `StreetViewPanoramaData` is passed to the provided callback. |

## [StreetViewStatus](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewStatus)
constants


constants
`google.maps.StreetViewStatus`

library `"streetView"`

The status returned by the `StreetViewService` on completion of a Street View request. These can be specified by value, or by using the constant's name. For example, `'OK'` or `google.maps.StreetViewStatus.OK`.

These constants are also usable as strings. In TypeScript, the string literals are defined by the `StreetViewStatusString` type.

```javascript
const {StreetViewStatus} = await google.maps.importLibrary("streetView");
```

| ### Constants ||
|---|---|
| `OK` | The request was successful. |
| `UNKNOWN_ERROR` | The request could not be successfully processed, yet the exact reason for failure is unknown. |
| `ZERO_RESULTS` | There are no panoramas found that match the search criteria. |

## [StreetViewLocationRequest](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewLocationRequest)
interface


interface
`google.maps.StreetViewLocationRequest`

A Street View request to be sent with `getPanorama`. `StreetViewLocationRequest` lets you search for a Street View panoroma at a specified location.

| ### Properties ||
|---|---|
| `location` optional | **Type:** `LatLng|LatLngLiteral optional` Specifies the location where to search for a Street View panorama. |
| `preference` optional | **Type:** `StreetViewPreference optional` Sets a preference for which panorama should be found within the radius: the one nearest to the provided location, or the best one within the radius. |
| `radius` optional | **Type:** `number optional` **Default:** `50` Sets a radius in meters in which to search for a panorama. |
| `[source](https://developers.google.com/maps/documentation/javascript/reference/street-view-service#StreetViewLocationRequest.source)` optional | > [!WARNING] > **[Deprecated:](https://developers.google.com/maps/deprecations.md.txt)** Use `sources` instead. **Type:** `StreetViewSource optional` **Default:** `StreetViewSource.DEFAULT` Specifies the source of panoramas to search. This allows a restriction to search for just outdoor panoramas for example. |
| `sources` optional | **Type:** `Iterable<StreetViewSource> optional` **Default:** \[`StreetViewSource.DEFAULT`\] Specifies the sources of panoramas to search. This allows a restriction to search for just outdoor panoramas for example. Setting multiple sources will be evaluated as the intersection of those sources. |

## [StreetViewPanoRequest](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewPanoRequest)
interface


interface
`google.maps.StreetViewPanoRequest`

A `StreetViewPanoRequest` is used with the `getPanorama` to find a panorama with a specified ID.

| ### Properties ||
|---|---|
| `pano` optional | **Type:** `string optional` Specifies the pano ID to search for. |

## [StreetViewResponse](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewResponse)
interface


interface
`google.maps.StreetViewResponse`

The response resolved for a Promise from `StreetViewService.getPanorama`.

| ### Properties ||
|---|---|
| `data` | **Type:** `StreetViewPanoramaData` The representation of a panorama. |

## [StreetViewLocation](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewLocation)
interface


interface
`google.maps.StreetViewLocation`

A representation of a location in the Street View panorama.

| ### Properties ||
|---|---|
| `pano` | **Type:** `string` A unique identifier for the panorama. This is stable within a session but unstable across sessions. |
| `description` optional | **Type:** `string optional` A localized string describing the location. |
| `latLng` optional | **Type:** `LatLng optional` The latlng of the panorama. |
| `shortDescription` optional | **Type:** `string optional` Short description of the location. |

## [StreetViewPreference](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewPreference)
constants


constants
`google.maps.StreetViewPreference`

library `"streetView"`

Options that bias a search result towards returning a Street View panorama that is nearest to the request location, or a panorama that is considered most likely to be what the user wants to see. Specify these by value, or by using the constant's name. For example, `'best'` or `google.maps.StreetViewPreference.BEST`.

These constants are also usable as strings. In TypeScript, the string literals are defined by the `StreetViewPreferenceString` type.

```javascript
const {StreetViewPreference} = await google.maps.importLibrary("streetView");
```

| ### Constants ||
|---|---|
| `BEST` | Return the Street View panorama that is considered most likely to be what the user wants to see. The best result is determined by algorithms based on user research and parameters such as recognised points of interest, image quality, and distance from the given location. |
| `NEAREST` | Return the Street View panorama that is the shortest distance from the provided location. This works well only within a limited radius. The recommended radius is 1km or less. |

## [StreetViewSource](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewSource)
constants


constants
`google.maps.StreetViewSource`

library `"streetView"`

Identifiers to limit Street View searches to selected sources. These values are specified as strings. For example, `'outdoor'`.

These constants are also usable as strings. In TypeScript, the string literals are defined by the `StreetViewSourceString` type.

```javascript
const {StreetViewSource} = await google.maps.importLibrary("streetView");
```

| ### Constants ||
|---|---|
| `DEFAULT` | Uses the default sources of Street View, searches will not be limited to specific sources. |
| `GOOGLE` | Limits Street View searches to official Google collections. |
| `OUTDOOR` | Limits Street View searches to outdoor collections. Indoor collections are not included in search results. Note also that the search only returns panoramas where it's possible to determine whether they're indoors or outdoors. For example, PhotoSpheres are not returned because it's unknown whether they are indoors or outdoors. |

## [StreetViewPanoramaData](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewPanoramaData)
interface


interface
`google.maps.StreetViewPanoramaData`

The representation of a panorama returned from the provider defined using `registerPanoProvider`.

| ### Properties ||
|---|---|
| `tiles` | **Type:** `StreetViewTileData` Specifies the custom tiles for this panorama. |
| `copyright` optional | **Type:** `string optional` Specifies the copyright text for this panorama. |
| `imageDate` optional | **Type:** `string optional` Specifies the year and month in which the imagery in this panorama was acquired. The date string is in the form YYYY-MM. |
| `links` optional | **Type:** `Array<StreetViewLink> optional` Specifies the navigational links to adjacent panoramas. |
| `location` optional | **Type:** `StreetViewLocation optional` Specifies the location meta-data for this panorama. |

## [StreetViewLink](https://developers.google.com/maps/documentation/javascript/reference/street-view-service.md.txt#StreetViewLink)
interface


interface
`google.maps.StreetViewLink`

A collection of references to adjacent Street View panos.

| ### Properties ||
|---|---|
| `description` optional | **Type:** `string optional` A localized string describing the link. |
| `heading` optional | **Type:** `number optional` The heading of the link. |
| `pano` optional | **Type:** `string optional` A unique identifier for the panorama. This id is stable within a session but unstable across sessions. |