Export (0) Print
Expand All

TileLayer Class

Bing

Represents a tile layer.

Constructor

Name Definition Description

TileLayer

TileLayer( options: TileLayerOptions )

Initializes a new instance of the TileLayer class.

Methods

Name Definition Return Type Description

getOpacity

getOpacity()

number

Returns the opacity of the tile layer, defined as a double between 0 (not visible) and 1.

getTileSource

getTileSource(projection:string)

TileSource

Returns the tile source of the tile layer.

The projection parameter accepts the following values: mercator, enhancedBirdseyeNorthUp, enhancedBirdseyeSouthUp, enhancedBirdseyeEastUp, enhancedBirdseyeWestUp

getVisible

getVisible()

boolean

Returns whether the tile layer is visible. A value of false indicates that the tile layer is hidden.

getZIndex

getZIndex()

number

Returns the z-index of the tile layer with respect to other items on the map.

setOptions

setOptions(options: TileLayerOptions )

None

Sets options for the tile layer.

toString

toString()

string

Converts the TileLayer object to a string.

Events

Name Arguments Description

tiledownloadcomplete

None

Occurs when all the tiles of the tile layer have loaded.

Example

<!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=7.0"></script>

      <script type="text/javascript">
         
         function GetMap()
         {
            // Initialize the map
            var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
{credentials:"Bing Maps Key", center:new Microsoft.Maps.Location(48.03,-
122.4), zoom:12, mapTypeId: Microsoft.Maps.MapTypeId.road }); 

            try
            {
               // Create the tile layer source
               var tileSource = new Microsoft.Maps.TileSource({uriConstructor: 
'http://www.microsoft.com/maps/isdk/ajax/layers/lidar/{quadkey}.png'});

               // Construct the layer using the tile source
               var tilelayer= new Microsoft.Maps.TileLayer({ mercator: tileSource, opacity: .7 });

               // Push the tile layer to the map
               map.entities.push(tilelayer);

            }
            catch(err)
            {
               alert( 'Error Message:' + err.message);
            }


         }


      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>       
   </body>
</html>

See Also

Show:
© 2014 Microsoft