I, everyone!
I create a world map using this code:
Cesium.BingMapsApi.defaultKey = 'MY KEY';
var viewer = new Cesium.Viewer('cont', {
selectionIndicator: false,
navigationHelpButton: false,
navigationInstructionsInitiallyVisible: false,
baseLayerPicker: false,
geocoder : [
new Cesium.CartographicGeocoderService(),
new Cesium.BingMapsGeocoderService()
],
terrainProvider: Cesium.createWorldTerrain(
{
requestWaterMask: true,
requestVertexNormals: true
})
});
var imageryProv = new Cesium.BingMapsImageryProvider({
url: '//dev.virtualearth.net',
mapStyle: Cesium.BingMapsStyle.AERIAL
});
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(imageryProv);
I have warning: "This application is using Cesium's default ion access token. Please assign Cesium.Ion.defaultAccessToken with an access token from your ion account before making any Cesium API calls".
I don't want to use Ion in my project. In documentation i saw that BingMapsImageryProvider by default is provided through Cesium ion. To go back to the old default behavior with BingMaps my code should be like:
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProvider : new Cesium.BingMapsImageryProvider({
url : 'https://dev.virtualearth.net'
}),
geocoder : [
new Cesium.CartographicGeocoderService(),
new Cesium.BingMapsGeocoderService()
]
});
I've done all like in example, but warning is still there. Also i change geocoder to false. Nothing changed too.
What can be wrong with my code?
Thank you for any help.
You’re right, I just tried it out. Looks like that warning will be there as long as as Cesium.Ion.defaultAccessToken is set, because even if you’re not loading imagery from ion on startup, you could still load assets and it’ll use the default access token.
So all you have to do is set it to null or something else and that should remove the warning. The example below works for me.
Cesium.Ion.defaultAccessToken = null;
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
imageryProvider: new Cesium.BingMapsImageryProvider({
thanks again!
As Ion defaultAccessToken tried null and valid ion token, but, unfortunately, with your example i still have the warning.
I know that ion is by default in geocoder, imageryProvider and terrainProvider in cesiumjs 1.48, but in github i saw that the last version also should work with previos cesium's default bingmaps key.
If I use terrainProvider i can only use IonImageryProvider and IonGeocoderService instead of geocoder and imageryProvider (with BingMap key)? How should code looks like (to avoid warning with token access)? Thanks.
I fixed warning. My problem was in invalid ion access token (don't know why it was invalid, i checked it many times). I replace program with new ion token and my code works. Omar, many thanks for your help.