GoogleStreetViewCubeMapPanoramaProvider
Cesium v1.147 · 中文

new Cesium.GoogleStreetViewCubeMapPanoramaProvider()

通常不直接实例化此对象,请使用 GoogleStreetViewCubeMapPanoramaProvider.fromUrl。
创建一个 PanoramaProvider,从 Google Street View Static API 提供影像,以在全景图中显示。
Demo:
See:

Methods

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

创建 PanoramaProvider,从 Google Street View Static API 提供立方体面图像。
Name Type Description
options object 具有以下属性的对象:
Name Type Default Description
key string GoogleMaps.defaultStreetViewStaticApiKey optional 用于访问 Google 街景静态 API 的 API 密钥。有关如何生成自己密钥的说明,请参见 https://developers.google.com/maps/documentation/javascript/get-api-key。如果未定义,则使用默认值 GoogleMaps.defaultStreetViewStaticApiKey。如果该值不可用,则回退到 GoogleMaps.defaultApiKey。
url string | Resource GoogleMaps.streetViewStaticApiEndpoint optional 用于访问 Google 街景静态 API 的 URL。更多详情请参见 https://developers.google.com/maps/documentation/streetview/overview。
tileSize number 600 optional 每个正方形瓦片默认的宽度和高度(以像素为单位)。
credit Credit | string optional 显示在画布上的数据源标识。
Returns:
A resolves为创建的 GoogleStreetViewCubeMapPanoramaProvider 的 promise。
Example:
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
key: '你的 Google 街景静态 API 密钥'
})

getNearestPanoId(position, radius) → object

获取给定地图坐标的 panoId。请参阅 https://developers.google.com/maps/documentation/tile/streetview#panoid-search。
Name Type Default Description
position Cartographic 用于查找最近 panoId 的位置。
radius number 50 optional 用于查找最近 panoId 的米制半径。
Returns:
an 包含最近全景图的 panoId、纬度和经度的对象。
Example:
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
key: '你的 Google Street View Static API 密钥'
})
const panoIds = provider.getNearestPanoId(position);
获取 panoId 的元数据。有关响应对象,请参阅 https://developers.google.com/maps/documentation/tile/streetview#metadata_response。
Name Type Description
panoId string
Returns:
object 包含 panoId 的元数据。
Example:
const panoIdObject = provider.getNearestPanoId(position);
const panoIdMetadata = provider.getPanoIdMetadata(panoIdObject.panoId);
获取指定位置和方向的全景图原语。
Name Type Description
options object 该对象包含以下属性:
Name Type Description
cartographic Cartographic 将全景图放置在场景中的位置。
panoId string optional 在 Google API 中用于识别图像的 panoId 标识符。如果未提供,则根据提供的地图坐标查找该标识符。
tileSize number optional 可选的瓦片尺寸覆盖(方形)。
signature string optional 可选签名用于签名 URL。有关更多信息,请参阅 https://developers.google.com/maps/documentation/streetview/digital-signature。
credit Credit | string optional 显示于画布上的数据源标识。
Returns:
The 使用影像纹理化的全景图原语。
Example:
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
key: '你的 Google Street View Static API 密钥'
})

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.