คำตอบ How can i add multiple pushpins

  • Tuesday, March 11, 2008 10:38 AM
     
     

     

    I have to add multiple pushpins in my map . i pass different latitudes and longitudes .Can any one post the code

All Replies

  • Tuesday, March 11, 2008 1:02 PM
    Owner
     
     Answered
    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>


  • Friday, September 09, 2011 9:57 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

  • Sunday, February 12, 2012 6:19 PM
    Owner
     
     
    This post looks extremely familiar: http://rbrundritt.wordpress.com/2011/10/13/multiple-pushpins-and-infoboxes-in-bing-maps-v7/ 

    http://rbrundritt.wordpress.com