bing map 图

<!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=6.2"></script>  
  
      <script type="text/javascript">  
         var map = null;   
  
         var LA = new VELatLong(34.0540, -118.2370);   
  
         var pinPoint = null;   
         var pinPixel = null;   
                     
         function GetMap()   
         {   
            map = new VEMap('myMap');   
            map.LoadMap(LA, 14, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);   
  
            AddPin();   
         }   
  
         function getInfo()   
         {   
            var info;   
  
            if (map.IsBirdseyeAvailable())   
            {   
                var be = map.GetBirdseyeScene();   
  
                info  = "ID: "          + be.GetID() + "\n";   
                info += "orientation: " + be.GetOrientation()+ "\n";   
                info += "height: "      + be.GetHeight() + "\n";   
                info += "width: "       + be.GetWidth() + "\n";   
  
                var pixel = be.LatLongToPixel(map.GetCenter(), map.GetZoomLevel());   
  
                info += "LatLongToPixel: " + pixel.x + ", " + pixel.y + "\n";   
  
                // Check to see if the current birdseye view contains the pushpin pixel point.   
                info += "contains pixel " + pinPixel.x + ", " + pinPixel.y + ": " +    
                        be.ContainsPixel(pinPixel.x, pinPixel.y, map.GetZoomLevel()) + "\n";  
                   
                // Check to see if the current view contains the pushpin LatLong.   
                info += "contains latlong " + pinPoint + ": " + be.ContainsLatLong(pinPoint) + "\n";   
                   
                // This method may return null, depending on the selected view and map style.   
                info += "latlong: " + map.PixelToLatLong(pixel);   
  
                alert(info);   
            }   
            else   
            {   
                var center = map.GetCenter();   
  
                info  = "Zoom level:\t" + map.GetZoomLevel() + "\n";   
                info += "Latitude:\t"   + center.Latitude    + "\n";   
                info += "Longitude:\t"  + center.Longitude;   
  
                alert(info);   
            }   
         }   
            
        function AddPin()   
         {   
            // Add a new pushpin to the center of the map.   
            pinPoint = map.GetCenter();   
            pinPixel = map.LatLongToPixel(pinPoint);   
            map.AddPushpin(pinPoint);   
         }   
      </script>  
   </head>  
   <body οnlοad="GetMap();">  
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>  
       <input id="btnGetInfo" type="button" value="Get Scene Information" name="getinfo" οnclick="getInfo();">  
       <br/>  
        (zoom out 5 clicks to get latitude/longitude and zoom level)   
   </body>  
</html>  

 網上收集整理

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值