none
Hide the Bing Map part of a map control while keeping the entity polygons that you have pushed on to it for printing RRS feed

  • Question

  • Hello,

    I was wondering if anyone has any experience w/ hiding the Bing Map part of a map control while keeping the entity polygons that you have pushed on to it?  We are using v 7.0 of the Bing map control.  The reason for attempting this functionality is that we would like to be able to print just the polygon’s.  Here is the basic of my code as it is now:

     

     

              function GetMap() {

                var mapOptions = new Object();

                mapOptions.credentials = "key";

                mapOptions.center = new Microsoft.Maps.Location(28.091366281406944, -82.99072265625);

                mapOptions.zoom = 5;

                var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions);

                var polygoncolor;

                var polygon;

                //polygoncolor = new Microsoft.Maps.Color(Microsoft.Maps.Color.fromHex("9ffeba831").toString());

                polygoncolor = new Microsoft.Maps.Color(100,100,0,100);

                var vertices = new Array();

                polygon = new Microsoft.Maps.Polygon(vertices,{fillColor: polygoncolor, strokeColor: polygoncolor});

                map.entities.push(polygon);

              }

     

     

    Thanks ahead of time for any help,

    Derek


    derek
    • Moved by Ricky_Brundritt Friday, March 9, 2012 4:21 PM (From:Bing Maps: Map Control and Web services Development)
    Monday, March 21, 2011 5:25 PM

Answers

  • Hi there,

    I'm not quite sure what the "Bing Maps" part of the control is (surely, it being a Bing Maps Control, the whole thing is Bing Maps?) - but if what you mean is that you want to hide the base tile layers, you can do this by setting the MapTypeId property to "mercator":

    <!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 type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-gb"></script>
    
       <script type="text/javascript">
       function GetMap()
       {  
    
         var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), 
         {credentials:"Bing Maps Key", 
          center: new Microsoft.Maps.Location(51.5, -.1),
          zoom: 10, 
          mapTypeId:Microsoft.Maps.MapTypeId.mercator}
          );
       }
       </script>
      </head>
      <body onload="GetMap();">
       <div id='mapDiv' style="position:relative; width:600px; height:600px;"></div>    
      </body>
    </html>
    
    


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Monday, March 21, 2011 7:27 PM
    Moderator

All replies

  • Hi there,

    I'm not quite sure what the "Bing Maps" part of the control is (surely, it being a Bing Maps Control, the whole thing is Bing Maps?) - but if what you mean is that you want to hide the base tile layers, you can do this by setting the MapTypeId property to "mercator":

    <!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 type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-gb"></script>
    
       <script type="text/javascript">
       function GetMap()
       {  
    
         var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), 
         {credentials:"Bing Maps Key", 
          center: new Microsoft.Maps.Location(51.5, -.1),
          zoom: 10, 
          mapTypeId:Microsoft.Maps.MapTypeId.mercator}
          );
       }
       </script>
      </head>
      <body onload="GetMap();">
       <div id='mapDiv' style="position:relative; width:600px; height:600px;"></div>    
      </body>
    </html>
    
    


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Monday, March 21, 2011 7:27 PM
    Moderator
  • Hi Alastair,

    That is exactly what I was looking. Good man.  Thanks for passing that along. 

     

    Cheers


    derek
    Monday, March 21, 2011 8:23 PM