VEMap.GetTileLayerByID 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.
Gets a tile layer based upon its identifier.
VEMap.GetTileLayerByID(id);
Parameters
Parameter | Description |
---|---|
id |
The unique identifier of the tile layer |
Return Value
A VETileSourceSpecification Class object.
Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>ShowHideBaseTileLayer</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;
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 tileSourceSpec =
new VETileSourceSpecification(
"lidar",
"https://www.microsoft.com/maps/isdk/ajax/layers/lidar/%4.png",
1,
bounds,
10,
18,
null,
0.5,
100);
map.AddTileLayer(tileSourceSpec, true);
}
function GetTileLayerInfo()
{
var tileLayer = map.GetTileLayerByID("lidar");
var layerinfo = "The tile layer " + map.GetTileLayerByIndex(0).ID + " has an opacity setting of " + tileLayer.Opacity + ".<br/>";
setDivText("layerinfo", layerinfo);
}
function setDivText(dId, s)
{
var d = document.getElementById(dId);
d.innerHTML = s;
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:600px; height:400px;"></div>
<input type="button" value="Get Tile Layer Info" onclick="GetTileLayerInfo();"/><br>
<div id='layerinfo'></div>
</body>
</html>
See Also
Reference
VEMap.GetTileLayerByIndex Method
VEMap.GetTileLayerCount Method