createGooglePhotorealistic3DTileset
suspend external fun createGooglePhotorealistic3DTileset(apiOptions: CreateGooglePhotorealistic3DTilesetOptions? = definedExternally, tilesetOptions: Cesium3DTileset.ConstructorOptions? = definedExternally): Cesium3DTileset(source)
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.
const viewer = new Viewer("cesiumContainer", {
geocoder: IonGeocodeProviderType.GOOGLE
});
try {
const tileset = await createGooglePhotorealistic3DTileset({
onlyUsingWithGoogleGeocoder: true,
});
viewer.scene.primitives.add(tileset));
} catch (error) {
console.log(`Error creating tileset: ${error}`);
}
Content copied to clipboard
// Use your own Google Maps API key
GoogleMaps.defaultApiKey = "your-api-key";
const viewer = new Viewer("cesiumContainer". {
geocoder: IonGeocodeProviderType.GOOGLE
});
try {
const tileset = await createGooglePhotorealistic3DTileset({
onlyUsingWithGoogleGeocoder: true,
});
viewer.scene.primitives.add(tileset));
} catch (error) {
console.log(`Error creating tileset: ${error}`);
}
Content copied to clipboard
Parameters
apiOptions.key
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. Default value - GoogleMaps.defaultApiKey
apiOptions.onlyUsingWithGoogleGeocoder
Confirmation that this tileset will only be used with the Google geocoder.
tilesetOptions
An object describing initialization options.