美文网首页
jQuery高德地图定位,缩放

jQuery高德地图定位,缩放

作者: 喵呜Yuri | 来源:发表于2019-04-11 16:05 被阅读0次
image.png
<script src="https://webapi.amap.com/maps?v=1.4.14&key=您申请的key值"></script>
//<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.4&key=分配给你的key值&plugin=AMap.ToolBar"></script>
<script>
    map = new AMap.Map("position", {
        zoom:10, //地图显示的缩放级别
        center: [116.397428, 39.90923],//中心点坐标
    });
    marker = new AMap.Marker({
        map: map,
        position:[116.39, 39.9]//位置
    })
    
 var msg_label = '<span>测试使用的Label的</span>';
marker.setLabel({
    offset: new AMap.Pixel(20, -10), //lable距离content的显示位置
    content: msg_label //显示内容
});

    marker.on('click', function (e) {
        marker.markOnAMAP({
            name: msg_label,
            position: marker.getPosition()
        })
    })
</script>
点击登录注册
image.png
注册成为开发者,申请key
image.png
控制台--应用管理-我的应用。创建一个应用
image.png
点击右上方“+”添加key
image.png
高德地图相关API文档:https://lbs.amap.com/api/javascript-api/example/map-lifecycle/map-show
参考网站:https://lbs.amap.com/api/javascript-api/guide/abc/quickstart

相关文章

网友评论

      本文标题:jQuery高德地图定位,缩放

      本文链接:https://www.haomeiwen.com/subject/laatwqtx.html