操作步骤
- 首先需要去申请一个key,直接在控制台添加就好了,链接
- 页面中合适的位置创建一个div,并有一个id
- 使用上面div的id创建一个map对象,导入相应的js链接和key值,链接
- 图面显示出地图,链接
- 地图上有一些插件可以使用,链接
效果图

code
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<style type="text/css">
body,
html,
#meMap {
width: 100%;
height: 100%;
margin: 0px
}
</style>
<title>简单地图加载</title>
</head>
<body>
<div id="meMap" tabindex="0"></div>
<script src="https://webapi.amap.com/maps?v=1.4.2&key=58a21c1753060ec67806dab865753535"></script>
<script type="text/javascript" src="https://webapi.amap.com/demos/js/liteToolbar.js"></script>
<script type="text/javascript">
var map = new AMap.Map('meMap', {
resizeEnable: true,
center: [122, 35.88989],
zoom: 15,
viewMode: '3D'
});
AMap.plugin('AMap.ToolBar', function() {
var toolbar = new AMap.ToolBar();
map.addControl(toolbar)
});
var marker = new AMap.Marker({
position: map.getCenter(),
offset: new AMap.Pixel(-5, -5),
icon: ico,
zoom: 13
});
marker.setTitle("当前的位置");
marker.setLabel({
offset: new AMap.Pixel(10, 30),
content: "当前的位置"
});
var ico = new AMap.Icon({
size: new AMap.Size(24, 30),
image: 'static/333.jpeg',
imageOffset: new AMap.Pixel(0, 0),
imageSize: new AMap.Size(24, 30)
});
map.add(marker);
</script>
</body>
</html>