VEMap.AddPushpin Method
Adds a pushpin (a VEShape Class object of type VEShapeType Enumeration.Pushpin) to the base map layer.
Syntax
VEMap.AddPushpin(points);
Parameters
Parameter | Description |
---|---|
points |
This is a single VELatLong Class representing the pushpin's location on the map. Required. |
Return Value
A reference to the VEShape Class object that was created.
Remarks
Any pushpin added using this method will be added to the map's base layer. To add a pushpin to a specific layer, use VEShapeLayer.AddShape Method.
Examples
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
<script>
var map = null;
var pinID = 1;
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
}
function AddPin()
{
var center = map.GetCenter();
var pin = map.AddPushpin(center);
pin.SetTitle('This is the title text');
pin.SetDescription('This is the description text.');
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<a href="#" onclick="AddPin();">Add a pushpin to the center of the map</a>
</body>
</html>