一、准备工作
百度地图开发文档
- 注册百度账号,成为开发人员,同时获取AK
- 实例代码:
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="user-scalable=no, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Hello World</title><style type="text/css">html{height:100%}body{height:100%;margin:0px;padding: 0px}#container{height:100%}</style><script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=18w9Wpk8SKphulGgHbrsMKQV7ExOW1BS"></script>
</head>
<body><h1>5464654456</h1><div id="container"></div><script type="text/javascript">var map = new BMap.Map("container");//创建地图实例var point = new BMap.Point(116.404,39.915);//创建点坐标map.centerAndZoom(point,15);//初始化地图,设置中心点坐标和地图级别</script>
</body>
</html>
复制代码
地图api