<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>自定义点标记图标大小</title>
<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.5&key=申请的key"></script>
<script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
//初始化地图对象,加载地图
var map = new AMap.Map("container", {
resizeEnable: true,
zoom:17
});
//添加点标记,并使用自己的icon
new AMap.Marker({
map: map,
position: [114.597599,37.605084],
icon: new AMap.Icon({
image: "marker1.png",
size: new AMap.Size(52, 52, //图标大小
imageSize: new AMap.Size(26,26)
})
});
//添加点标记,并使用自己的icon
new AMap.Marker({
map: map,
position: [114.597181,37.605161],
icon: new AMap.Icon({
image: "marker2.png",
size: new AMap.Size(52, 52), //图标大小
imageSize: new AMap.Size(26,26)
})
});
</script>
</body>
</html>
高德地图 自定义点标记 图标大小
最新推荐文章于 2024-09-23 11:03:01 发布