网页嵌入百度地图和调用百度地图api展示拥堵代码
XX城市路况拥堵图
<html>
<head>
<title>兰州市实时路况</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/lz_traffice_map.js"></script>
<script type="text/javascript">
$(function() {
var map = new BMap.Map("mapContainer");
map.centerAndZoom(new BMap.Point(103.840745,36.067329), 16);
var ctrl = new BMapLib.TrafficControl({
showPanel: false
});
map.addControl(new BMap.NavigationControl());
map.enableContinuousZoom(false);
map.enableScrollWheelZoom(false);
map.addControl(ctrl);
ctrl.setAnchor(BMAP_ANCHOR_BOTTOM_RIGHT);
ctrl.showTraffic();
});
//按坐标移动
function goPosition(xPos,yPos){
var mapa = new BMap.Map("mapContainer");
mapa.centerAndZoom(new BMap.Point(xPos,yPos), 16);
var ctrla = new BMapLib.TrafficControl({
showPanel: false
});
mapa.addControl(new BMap.NavigationControl());
mapa.enableContinuousZoom(false);
mapa.enableScrollWheelZoom(true);
mapa.addControl(ctrla);
ctrla.setAnchor(BMAP_ANCHOR_BOTTOM_RIGHT);
ctrla.showTraffic();
}
</script>
<style type="text/css">
#mapContainer {width:949px;height:500px;}
.traffic_container {width:1010px;background-color:#FFF;}
.left_map_container{float:left;width:949px;border:1px solid #1970CF;}
.left_map_container h4{display:block;width:949px;height:33px;line-height:33px;text-indent:12px; overflow:hidden;padding:0px;margin:0px;background:url('images/bg1.gif') repeat-x left top;color:#FFF;}
.left_map_container h4 .traffic_status_icon {float:right;width:110px;height:34px;margin-top:0px;background:url('images/traffic_status.png') no-repeat center center;}
.BMap_cpyCtrl{display:none;}.anchorBL{display:none;}
</style>
</head>
<body>
<!--内容开始-->
<div class="traffic_container">
<div class="left_map_container">
<h4>兰州市实时路况<span class="traffic_status_icon"></span></h4>
<div id="mapContainer"></div>
</div>
</div>
<div style="color:#444;font-size:12px;padding:10px 3px;">实时路况</div>
</body>
</html>
猜你喜欢
- /
- /lz_traffic
- /lz_traffic/images
- /lz_traffic/images/Thumbs.db
- /lz_traffic/images/bg1.gif
- /lz_traffic/images/bg2.gif
- /lz_traffic/images/traffic_status.png
- /lz_traffic/js
- /lz_traffic/js/dtree
- /lz_traffic/js/dtree/dtree.css
- /lz_traffic/js/dtree/lz_traffice_map.js
- /lz_traffic/js/jquery.min.js
- /lz_traffic/js/lz_traffice_map.js
- /lz_traffic/js/dtree
- /lz_traffic/lz_traffic_map.html
- /lz_traffic/images
- /lz_traffic
- 百度地图使用实例
- android 百度地图Demo
- 证 百度API省市GIS地图后台管理模板
- 精 百度地图显示多个坐标并连线显示用户轨迹
- 原 java开发百度地图定位简单实例
- 百度地图android sdk v3.0.0实例demo
- 原 百度地图:实现功能(1.点击标注2.限制区域搜索3.ip定位(正在研究精准定位, 后期更新))
- java swing和百度地图进行的定位与搜索
- 原 百度地图根据坐标显示、标注信息、添加动画标注点
- 原 Openlayers4地图开发入门示例--加载百度离线地图和OSM地图
- java常用地图坐标系转换工具类,支持谷歌,腾讯,百度等主流的地理坐标转换
- 原证精 分享下百度最代码关键词链接被垃圾站iapolo.com追加?iapolo.com的解决方案