• express中使用高德地图


    1.首先要注册高德地图,完后成为开发者

    2.控制台里获取自己的key值

    3.在要显示地图的页面添加如下的代码

    <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
    <script src="//webapi.amap.com/ui/1.0/main.js"></script>
    <div id="container" style="height: 600px"></div>

    <script>

    var toolBar;
    var customMarker = new AMap.Marker({
    offset: new AMap.Pixel(-14, -34),     //相对于基点的位置
    icon: new AMap.Icon({     //复杂图标
    size: new AMap.Size(27, 36),     //图标大小
    image: "http://webapi.amap.com/images/custom_a_j.png",      //大图地址
    imageOffset: new AMap.Pixel(-28, 0)         //相对于大图的取图位置
    })
    });
    var map = new AMap.Map('container', {
    resizeEnable: true,
    zoom:11,
    center: [116.397428, 39.90923]
    });
    AMap.plugin(['AMap.ToolBar','AMap.Scale','AMap.OverView'],
    function(){
    map.addControl(new AMap.ToolBar());

    map.addControl(new AMap.Scale());

    map.addControl(new AMap.OverView({isOpen:true}));
    });

    </script>

    4.在登录后的页面头加入

    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <script src="http://webapi.amap.com/maps?v=1.4.2&key=您的key值"></script>

  • 相关阅读:
    Linux mysql 远程访问
    Linux下高并发socket最大连接数所受的各种限制
    Linux之gunzip命令
    不停在终端中报log
    FIO测试
    yum是什么?(linux命令)
    ubuntu grub 登录
    百度网盘命令行方式,解决ubuntu16.04百度网盘无法运行的问题
    excel使用经验汇总
    ubuntu 安装 ipfs 经验
  • 原文地址:https://www.cnblogs.com/guanghuizhang/p/8184271.html
Copyright © 2020-2023  润新知