none
How do we hide the Base Tiles in V7 ? RRS feed

  • Question

  • How do we hide the basetiles in V7 ?   We could do this in 6.3.
    Steve Kahler
    • Moved by Ricky_Brundritt Friday, March 9, 2012 3:42 PM (From:Bing Maps: Map Control and Web services Development)
    Friday, March 4, 2011 7:34 PM

Answers

  • It's not documented very well in MSDN, but setting the "mapTypeId" to "Microsoft.Maps.MapTypeId.mercator" does do it. I would advise against setting it to the string value of "m" since that is an internal value of the control and could change in future releases causing your app to break. It is best to use the MapTypeId enumeration when setting this value.

    <!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"></script>
       <script type="text/javascript">
         function GetMap() {
           alert(Microsoft.Maps.MapTypeId.mercator);
           var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
                  { credentials: "Your Bing Maps Key",
                    center: new Microsoft.Maps.Location(45.5, -122.5),
                    mapTypeId: Microsoft.Maps.MapTypeId.mercator,
                    zoom: 7
                  });
         }
       </script>
      </head>
      <body onload="GetMap();">
       <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>    
      </body>
    </html>
    


    Microsoft MVP - Bing Maps
    Blog: http://pietschsoft.com | Web.Maps.VE - ASP.NET AJAX Bing Maps Server Control
    Sunday, March 6, 2011 4:07 AM

All replies

  • map.setView({mapTypeId: 'm'});
    Saturday, March 5, 2011 12:53 AM
  • It's not documented very well in MSDN, but setting the "mapTypeId" to "Microsoft.Maps.MapTypeId.mercator" does do it. I would advise against setting it to the string value of "m" since that is an internal value of the control and could change in future releases causing your app to break. It is best to use the MapTypeId enumeration when setting this value.

    <!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"></script>
       <script type="text/javascript">
         function GetMap() {
           alert(Microsoft.Maps.MapTypeId.mercator);
           var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
                  { credentials: "Your Bing Maps Key",
                    center: new Microsoft.Maps.Location(45.5, -122.5),
                    mapTypeId: Microsoft.Maps.MapTypeId.mercator,
                    zoom: 7
                  });
         }
       </script>
      </head>
      <body onload="GetMap();">
       <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>    
      </body>
    </html>
    


    Microsoft MVP - Bing Maps
    Blog: http://pietschsoft.com | Web.Maps.VE - ASP.NET AJAX Bing Maps Server Control
    Sunday, March 6, 2011 4:07 AM