Disabling Basemap in Local 3D Scene

1007
5
Jump to solution
08-21-2018 04:09 PM
TessOldemeyer
Occasional Contributor

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

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

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');
        }));
      },

View solution in original post

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

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');
        }));
      },
0 Kudos
TessOldemeyer
Occasional Contributor

Thank you so much. This is just what I was looking for. I'll give it a go!

0 Kudos
TessOldemeyer
Occasional Contributor

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

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tess,

   Sure just set the map.ground.opacity.

sceneView.map.ground.opacity = 0.4;

TessOldemeyer
Occasional Contributor

Sweet. That was it! 

Thank you!

0 Kudos