GoogleStreetViewCubeMapPanoramaProvider

new Cesium.GoogleStreetViewCubeMapPanoramaProvider()

This object is normally not instantiated directly, use GoogleStreetViewCubeMapPanoramaProvider.fromUrl.
Creates a PanoramaProvider which provides imagery from Google Street View Static API to be displayed in a panorama.
Demo:
See:

Methods

static Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl(options)Promise.<GoogleStreetViewCubeMapPanoramaProvider>

Creates a PanoramaProvider which provides cube face images from the Google Street View Static API.
Name Type Description
options object Object with the following properties:
Name Type Default Description
key string GoogleMaps.defaultStreetViewStaticApiKey optional Your API key to access Google Street View Static API. See https://developers.google.com/maps/documentation/javascript/get-api-key for instructions on how to create your own key. If undefined, defaults to GoogleMaps.defaultStreetViewStaticApiKey. If that value is unavailable, falls back to GoogleMaps.defaultApiKey.
url string | Resource GoogleMaps.streetViewStaticApiEndpoint optional The URL to access Google Street View Static API. See https://developers.google.com/maps/documentation/streetview/overview for more information.
tileSize number 600 optional Default width and height (in pixels) of each square tile.
credit Credit | string optional A credit for the data source, which is displayed on the canvas.
Returns:
A promise that resolves to the created GoogleStreetViewCubeMapPanoramaProvider.'
Example:
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
  key: 'your Google Streetview Static api key'
})

getNearestPanoId(position, radius)Object

Gets the panoIds for the given cartographic location. See https://developers.google.com/maps/documentation/tile/streetview#panoid-search.
Name Type Default Description
position Cartographic The position to search for the nearest panoId.
radius number 50 optional The radius in meters to search for the nearest panoId.
Returns:
an object containing a panoId, latitude, and longitude of the closest panorama
Example:
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
  key: 'your Google Streetview Static api key'
})
const panoIds = provider.getNearestPanoId(position);
Name Type Description
panoId string
Returns:
object containing metadata for the panoId.
Example:
const panoIdObject = provider.getNearestPanoId(position);
const panoIdMetadata = provider.getPanoIdMetadata(panoIdObject.panoId);
Gets the panorama primitive for a requested position and orientation.
Name Type Description
options object Object with the following properties:
Name Type Description
cartographic Cartographic The position to place the panorama in the scene.
panoId string optional The panoramaId identifier for the image in the Google API. If not provided this will be looked up for the provided cartographic location.
tileSize number optional Optional tile size override (square).
signature string optional Optional signature for signed URLs. See https://developers.google.com/maps/documentation/streetview/digital-signature for more information.
credit Credit | string optional A credit for the data source, which is displayed on the canvas.
Returns:
The panorama primitive textured with imagery.
Example:
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
  key: 'your Google Streetview Static api key'
})

const panoIdObject = provider.getNearestPanoId(position);
const position = Cartographic.fromDegrees(panoIdObject.location.lng, panoIdObject.location.lat, 0);

const primitive = await provider.loadPanorama({
  cartographic: position,
  panoId: panoIdObject.panoId
});
viewer.scene.primitive.add(primitive);
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.