English中文

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 用于访问 Google 街景静态 API 的 API 密钥。看 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 访问 Google 街景静态 API 的 URL。参见 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

获取给定制图位置的 panoId。参见 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 搜索最近的 panoId 的位置。 The position to search for the nearest panoId.
radius number 50 可选 optional 搜索最近 panoId 的半径(以米为单位)。 The radius in meters to search for the nearest panoId.
返回: Returns:
包含最近全景图的 panoId、纬度和经度的对象 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);
获取 panoId 的元数据。参见 Gets metadata for panoId. See https://developers.google.com/maps/documentation/tile/streetview#metadata_response 对于响应对象。 for response object.
名称 Name 类型 Type 说明 Description
panoId string
返回: Returns:
包含 panoId 元数据的对象。 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 Google API 中图像的 panoramaId 标识符。如果未提供,将查找所提供的制图位置。 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 签名 URL 的可选签名。参见 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.