Appearance
KBE3D / KBCore / Cesium / createGooglePhotorealistic3DTileset
函数: createGooglePhotorealistic3DTileset()
createGooglePhotorealistic3DTileset(
apiOptions?: {key?:string;onlyUsingWithGoogleGeocoder?:true; },tilesetOptions?:ConstructorOptions):Promise<Cesium3DTileset>
Creates a Cesium3DTileset instance for the Google Photorealistic 3D Tiles tileset.
Google Photorealistic 3D Tiles can only be used with the Google geocoder. To confirm that you are aware of this restriction pass usingOnlyWithGoogleGeocoder: true to the apiOptions. Otherwise a one time warning will be displayed when this function is called.
参数
apiOptions?
key?
string
Your API key to access Google Photorealistic 3D Tiles. See https://developers.google.com/maps/documentation/javascript/get-api-key for instructions on how to create your own key.
onlyUsingWithGoogleGeocoder?
true
Confirmation that this tileset will only be used with the Google geocoder.
tilesetOptions?
An object describing initialization options.
返回
Promise<Cesium3DTileset>
Examples
ts
const viewer = new Cesium.Viewer("cesiumContainer", {
geocoder: Cesium.IonGeocodeProviderType.GOOGLE
});
try {
const tileset = await Cesium.createGooglePhotorealistic3DTileset({
onlyUsingWithGoogleGeocoder: true,
});
viewer.scene.primitives.add(tileset));
} catch (error) {
console.log(`Error creating tileset: ${error}`);
}ts
// Use your own Google Maps API key
Cesium.GoogleMaps.defaultApiKey = "your-api-key";
const viewer = new Cesium.Viewer("cesiumContainer". {
geocoder: Cesium.IonGeocodeProviderType.GOOGLE
});
try {
const tileset = await Cesium.createGooglePhotorealistic3DTileset({
onlyUsingWithGoogleGeocoder: true,
});
viewer.scene.primitives.add(tileset));
} catch (error) {
console.log(`Error creating tileset: ${error}`);
}