OneDrive Developer Center (redirect)

Looking for the Live SDK?

OneDrive logo

The Live SDK 5.6 is now available

Find it on the OneDrive Dev Center, the new place to find samples, documentation, and other resources for integrating OneDrive into your app.
Choose your download

If you're using previous versions of the Live SDK, the Live SDK 5.5 reference is still available.

 none
How can i add multiple pushpins

Answers

  • If you can create an array of pushpins and add them all at once using the VEMap.AddShape method. This method will add either one VEShape or an Array of VEShapes. The following is an example of how this can be done:

    Code Snippet

    <!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 src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
          <script>
        var map = null;
                   
         function GetMap()
         {
              map = new VEMap('myMap');
              map.LoadMap();
              addPins();
         }
        
         function addPins()
         {
              var latlongs = new Array(new VELatLong(45,-110),new VELatLong(45,-114),new VELatLong(45,-90),new VELatLong(45,-95));  
              var pins = new Array();
             
              for(var i=0;i<latlongs.length;i++)
              {
                 pins.push(new VEShape(VEShapeType.Pushpin,latlongs[i]));    
              }
             
              map.AddShape(pins);
         }
    </script>
    </head>
       <body onload="GetMap();">
          <div align="left" id='myMap' style="position:relative; width:600px; height:400px;"></div>
       </body>
    </html>


    Tuesday, March 11, 2008 1:02 PM

All replies

  • If you can create an array of pushpins and add them all at once using the VEMap.AddShape method. This method will add either one VEShape or an Array of VEShapes. The following is an example of how this can be done:

    Code Snippet

    <!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 src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
          <script>
        var map = null;
                   
         function GetMap()
         {
              map = new VEMap('myMap');
              map.LoadMap();
              addPins();
         }
        
         function addPins()
         {
              var latlongs = new Array(new VELatLong(45,-110),new VELatLong(45,-114),new VELatLong(45,-90),new VELatLong(45,-95));  
              var pins = new Array();
             
              for(var i=0;i<latlongs.length;i++)
              {
                 pins.push(new VEShape(VEShapeType.Pushpin,latlongs[i]));    
              }
             
              map.AddShape(pins);
         }
    </script>
    </head>
       <body onload="GetMap();">
          <div align="left" id='myMap' style="position:relative; width:600px; height:400px;"></div>
       </body>
    </html>


    Tuesday, March 11, 2008 1:02 PM
  • Hi Richard

     

    This code is similar to what i need...but my longitudes  and latitudes are provided by  a gridview..gvCustomers...

     

    How can i use it to get multiple pushpins for each customer..Thank you

    Friday, September 09, 2011 9:57 PM
  • This post looks extremely familiar: http://rbrundritt.wordpress.com/2011/10/13/multiple-pushpins-and-infoboxes-in-bing-maps-v7/ 

    http://rbrundritt.wordpress.com

    Sunday, February 12, 2012 6:19 PM
OneDrive Developer Center (redirect)

Looking for the Live SDK?

OneDrive logo

The Live SDK 5.6 is now available

Find it on the OneDrive Dev Center, the new place to find samples, documentation, and other resources for integrating OneDrive into your app.
Choose your download

If you're using previous versions of the Live SDK, the Live SDK 5.5 reference is still available.