Export (0) Print
Expand All

VEMap.HideTileLayer 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.

Hides a tile layer from view.


VEMap.HideTileLayer(layerID);

Parameters

Parameter Description

layerID

The ID of the layer to be hidden.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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="http://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", 
            "http://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>

Show:
© 2014 Microsoft