VEMap.DeleteTileLayer Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Completely removes a tile layer from the map.

VEMap.DeleteTileLayer(layerID);

Parameters

Parameter Description

layerID

The ID of the layer to be deleted.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map = null;
         //var tileLayer;
         
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap(new VELatLong(48.03,-122.4),12,'r' ,false);

            GetTiles();
         }   
         
         function GetTiles()
         {
            var bounds = [new VELatLongRectangle(new VELatLong(49,-123),new VELatLong(47,-121))];
            var opacity = 0.9;

            var tileSourceSpec = new VETileSourceSpecification("lidar", 
            "https://www.microsoft.com/maps/isdk/ajax/layers/lidar/%4.png");
            tileSourceSpec.NumServers = 1;
            tileSourceSpec.Bounds = bounds;
            tileSourceSpec.MinZoomLevel = 10;
            tileSourceSpec.MaxZoomLevel = 18;
            tileSourceSpec.Opacity = opacity;
            tileSourceSpec.ZIndex = 100;

            map.AddTileLayer(tileSourceSpec, true);
            btnAdd.disabled="disabled";
            btnDelete.disabled=null;
            btnHide.disabled=null;
            btnShow.disabled="disabled";
         }  
         
         function DeleteTileLayer()
         {
            map.DeleteTileLayer("lidar");
            btnAdd.disabled=null;
            btnDelete.disabled="disabled";
            btnHide.disabled="disabled";
            btnShow.disabled="disabled";
         }  
                 
         function ShowTileLayer()
         {
            map.ShowTileLayer("lidar");
            btnAdd.disabled="disabled";
            btnDelete.disabled=null;
            btnHide.disabled=null;
            btnShow.disabled="disabled";
         }
                  
         function HideTileLayer()
         {
            map.HideTileLayer("lidar");
            btnAdd.disabled="disabled";
            btnDelete.disabled=null;
            btnHide.disabled="disabled";
            btnShow.disabled=null;
         }
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <input id="btnAdd" type="button" onclick="GetTiles()" value="Add Tile Layer"/>
      <input id="btnDelete" type="button" onclick="DeleteTileLayer()" value="Delete Tile Layer"/><br />
      <input id="btnHide" type="button" onclick="HideTileLayer()" value="Hide Tile Layer"/>
      <input id="btnShow" type="button" onclick="ShowTileLayer()" value="Show Tile Layer"/>
   </body>
</html>

See Also

Reference

VEMap.HideTileLayer Method
VEMap.ShowTileLayer Method