百度地圖3D效果

百度地圖的立體效果來實現

百度映射用於使用二維映射圖之前。如今,百度地圖找到支持立體效果。爲了實現立體效果只需要添加以下兩個示例代碼可:

map.setMapType(BMAP_PERSPECTIVE_MAP);     //改動地圖類型爲3D地圖
map.setCurrentCity("北京市");  //設置當前城市

,總體代碼例如以下:

<!html>
<!head>
<!meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<!meta name=“viewport” content=“initial-scale=1.0, user-scalable=no” />
<!style type=“text/css”>
body, html {width: 100%;height: 100%;margin:0;font-family:“微軟雅黑”;}
#allmap{width:100%;height:500px;}
#r-result{width:100%;margin-top:5px;}
p{margin:5px; font-size:14px;}
<!/style>
<!script type=“text/javascript” src="http://api.map.baidu.com/api?

v=2.0&ak=5qnG3inG4VhPZOcjNwj4ycZN">
<!title>百度三維地圖<!/title>
<!/head>
<!body>
<!div id=“allmap”>
<!/body>
<!/html>
<!script type=“text/javascript”>
// 百度地圖API功能
var map = new BMap.Map(“allmap”);
var point = new BMap.Point(116.404, 39.915);
map.centerAndZoom( point,18);

// 將標註加入到地圖中
//marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳動的動畫
//marker.enableDragging();
map.setMapType(BMAP_PERSPECTIVE_MAP);     //改動地圖類型爲3D地圖
map.setCurrentCity("北京市");  //設置當前城市

<!/script>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章