VEMap.AddCustomLayer Method
Bing Services
Adds a custom layer to the map.
VEMap.AddCustomLayer(object);
Parameters
| Parameter | Description |
|---|---|
|
object |
The object to add as a layer to the map DIV container. |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>AddCustomLayer</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 myLayer = null; function GetMap() { map = new VEMap('myMap'); map.LoadMap(); } // Add and remove custom layers function AddCustomLayer() { // Add a textbox to the surface of the map. myLayer = document.createElement('p'); myLayer.style.position = "absolute"; myLayer.style.top="150px"; myLayer.style.left="200px"; myLayer.style.width = "100px"; myLayer.style.height = "100px"; myLayer.style.zIndex = 2; myLayer.style.backgroundColor="lightblue"; myLayer.innerHTML = "This textbox is on the map."; map.AddCustomLayer(myLayer); } function RemoveCustomLayer() { map.RemoveCustomLayer(myLayer); } </script> </head> <body onload="GetMap();"> <div id='myMap' style="position:relative; width:600px; height:400px;"></div> <div id="links"><a href="#" onclick="AddCustomLayer()">Add Custom Layer</a> | <a href="#" onclick="RemoveCustomLayer()">Remove Custom Layer</a><br/></div> </body> </html>