Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

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

Returns a VELatLong Class object that represents the location of the center of the current map view.


This method returns when the map style is set to VEMapStyle.Birdseye or VEMapStyle.BirdseyeHybrid.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <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 pinID = 1;
         function GetMap()
            map = new VEMap('myMap');
         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.');
   <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>

© 2015 Microsoft