title: Removing layers from a leaflet map
body: <p>I am adding multiple layers with various opacities to my leaflet map object like this:</p>
  
  <pre><code> var TopoLayer = L.esri.dynamicMapLayer("https://gis.in.gov/arcgis/rest/services/Imagery_Basemap/MapServer", {
                          opacity: 0.8,
                          // Tell the map to use a loading control
  
                          useCors: false
                      }).addTo(map);
     var EPSLayer = L.esri.dynamicMapLayer("https://gis.in.gov/arcgis/rest/services/DOT/EPS_Map_2015/MapServer", {
                      opacity: 1,
                      // Tell the map to use a loading control
  
                      useCors: false
                  }).addTo(map);
  </code></pre>
  
  <p>Now when a user clicks on a checkbox, I would like remove the layer or add it back. I have tried </p>
  
  <pre><code>                    map.removeLayer("EPSLayer");
                      map.removeLayer("tiles");
  </code></pre>
  
  <p>However, that didnt fix the issue. Any ideas or pointers that could help would be greatly appreciated.</p>
  
  <p>*** Update I have created a fiddle to show the issue:</p>
  
  <p><a href="https://jsfiddle.net/31gmr4ss/3/" rel="noreferrer">https://jsfiddle.net/31gmr4ss/3/</a></p>
  
  <p>The idea is to click on the tree icon to show the areial view and then switch to the map view when its clicked again.</p>
  
  <p>It appears to work when the tree icon is clicked however the arial view is present when the map is zoomed. </p>
  
  <p>As @Fabrizio has suggested, the remove should not be passed string values, however passing just variable names causes the map to not work at all.</p>
  
  <p><img src="https://i.stack.imgur.com/vTh2A.jpg" alt="enter image description here"></p>
  
  <p>Thanks</p>