Is there a way to disable the default basemaps in a local scene in a web appbuilder (dev edition) application? Adjusting basemap transparency would also be a potential solution. I'm working on a subsurface 3D application where the layers have varying degrees of transparency, and an opaque basemap that I cannot seem to turn off makes it very hard to visualize the 3D layers.
Thanks in advance,
Tess
Solved! Go to Solution.
Tess,
If you are using WAB Developer edition the you can change code in the MapManager.js to do this:
Add line 9 - 11 to the _show3DWebScene function.
_show3DWebScene: function(appConfig) {
var portalUrl = appConfig.map.portalUrl;
var itemId = appConfig.map.itemId;
this._destroySceneView();
var def = WebSceneLoader.createMap(this.mapDivId, portalUrl, itemId);
def.then(lang.hitch(this, function(sceneView){
// this._publishMapEvent(map);
sceneView.map.watch('basemap', function(){
sceneView.map.allLayers.items[0].opacity = 0;
});
this._publishSceneViewEvent(sceneView);
if(appConfig.map.mapOptions){
var initialState = appConfig.map.mapOptions.initialState;
if(initialState && initialState.viewpoint){
try{
var vp = Viewpoint.fromJSON(initialState.viewpoint);
if(vp){
this.sceneView.map.initialViewProperties.viewpoint = vp;
this.sceneView.viewpoint = vp.clone();
}
}catch(e){
console.error(e);
}
}
}
}), lang.hitch(this, function(){
if (this.loading) {
this.loading.destroy();
}
topic.publish('mapCreatedFailed');
}));
},
Tess,
If you are using WAB Developer edition the you can change code in the MapManager.js to do this:
Add line 9 - 11 to the _show3DWebScene function.
_show3DWebScene: function(appConfig) {
var portalUrl = appConfig.map.portalUrl;
var itemId = appConfig.map.itemId;
this._destroySceneView();
var def = WebSceneLoader.createMap(this.mapDivId, portalUrl, itemId);
def.then(lang.hitch(this, function(sceneView){
// this._publishMapEvent(map);
sceneView.map.watch('basemap', function(){
sceneView.map.allLayers.items[0].opacity = 0;
});
this._publishSceneViewEvent(sceneView);
if(appConfig.map.mapOptions){
var initialState = appConfig.map.mapOptions.initialState;
if(initialState && initialState.viewpoint){
try{
var vp = Viewpoint.fromJSON(initialState.viewpoint);
if(vp){
this.sceneView.map.initialViewProperties.viewpoint = vp;
this.sceneView.viewpoint = vp.clone();
}
}catch(e){
console.error(e);
}
}
}
}), lang.hitch(this, function(){
if (this.loading) {
this.loading.destroy();
}
topic.publish('mapCreatedFailed');
}));
},
Thank you so much. This is just what I was looking for. I'll give it a go!
It looks like that worked for the basemap opacity, but the grid or ground surface is still opaque. It there a way to adjust the opacity of that?
Thanks again!
Tess
Tess,
Sure just set the map.ground.opacity.
sceneView.map.ground.opacity = 0.4;
Sweet. That was it!
Thank you!