<!DOCTYPE html>
<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,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=qEZVDmsH6cep8HGgnT0eG6bR6c1IUSsA"></script>
<script src="js/jquery.min.js"></script>
<title>地图展示</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
// 百度地图API功能
var map = new BMap.Map("allmap"); // 创建Map实例
map.setMapStyle({
styleJson:[
{
"featureType": "poi",
"elementType": "all",
"stylers": {
"color": "#ffffff",
"visibility": "off"
}
},
{
"featureType": "road",
"elementType": "all",
"stylers": {
"color": "#ffffff",
"visibility": "off"
}
}
]
});
map.centerAndZoom("郑州", 5); // 初始化地图,设置中心点坐标和地图级别
map.addControl(new BMap.MapTypeControl()); //添加地图类型控件
map.setCurrentCity("郑州"); // 设置地图显示的城市 此项是必须设置的
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
//map.disableScrollWheelZoom();//禁止鼠标滚轮缩放
map.disableDoubleClickZoom(true);//禁止双击缩放
map.addControl(new BMap.NavigationControl()); //添加默认缩放平移控件
map.addControl(new BMap.OverviewMapControl()); //添加默认缩略地图控件
var points = [];
points.push(new BMap.Point(112.979,28.213));
points.push(new BMap.Point(160.979,28.45));
points.push(new BMap.Point(140.979,28.108));
var options = {
size: BMAP_POINT_SIZE_NORMAL,
shape: BMAP_POINT_SHAPE_STAR,
color: 'green'
}
var pointCollection = new BMap.PointCollection(points, options);
map.addOverlay(pointCollection); // 添加Overlay
var pointss = [];
pointss.push(new BMap.Point(113.979,23.213));
pointss.push(new BMap.Point(163.979,23.45));
pointss.push(new BMap.Point(143.979,23.108));
var optionss = {
shape: BMAP_POINT_SHAPE_WATERDROP
}
var pointCollections = new BMap.PointCollection(pointss, optionss);
map.addOverlay(pointCollections); // 添加Overlay
</script>