How to remove layer from map in Web AppBuilder

2239
4
Jump to solution
05-17-2020 12:37 AM
Shalineemishra
New Contributor II

Hi

I am trying to remove layer from map in my web application.And I have  removed the layer from the LayerList widget but this layer show on my map.so please suggest how to remove or hide this layer on map using JavaScript API

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

If you want to remove a layer from the WAB map in JS code then you would use.

this.map.removeLayer(this.map.getLayer("incidentLayer"));

https://developers.arcgis.com/javascript/3/jsapi/map-amd.html#removelayer 

View solution in original post

4 Replies
DavidPike
MVP Frequent Contributor

If you want to remove layers you will need to remove them from the WebMap which the app is based on.

0 Kudos
SaraGilbert
New Contributor II

Is this still true?  I'd like to show just a couple of the webmap layers in my webmap app.   

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

If you want to remove a layer from the WAB map in JS code then you would use.

this.map.removeLayer(this.map.getLayer("incidentLayer"));

https://developers.arcgis.com/javascript/3/jsapi/map-amd.html#removelayer 

Shalineemishra
New Contributor II

Thank you so much

0 Kudos