• 百度地图


    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <style type="text/css">
            body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
        </style>
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=您的密钥"></script>
        <script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/changeMore.js"></script>
        <title>批量坐标转换</title>
    </head>
    <body>
        <div id="allmap"></div>
    </body>
    </html>
    <script type="text/javascript">
        // 百度地图API功能
        var map = new BMap.Map("allmap");
        map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
        var i;
        var markers = [];
        //注意:百度和谷歌的经纬度坐标顺序是相反的。
        var points = [new BMap.Point(116.3786889372559,39.90762965106183),
                      new BMap.Point(116.38632786853032,39.90795884517671),
                      new BMap.Point(116.39534009082035,39.907432133833574),
                      new BMap.Point(116.40624058825688,39.90789300648029),
                      new BMap.Point(116.41413701159672,39.90795884517671)
                     ];
        function callback(xyResults){
            var xyResult = null;
            for(var index in xyResults){
                xyResult = xyResults[index];
                if(xyResult.error != 0){continue;}//出错就直接返回;
                var point = new BMap.Point(xyResult.x, xyResult.y);
                var marker = new BMap.Marker(point);
                map.addOverlay(marker);
                map.setCenter(point);// 由于写了这句,每一个被设置的点都是中心点的过程
            }
        }
        setTimeout(function(){
            BMap.Convertor.transMore(points,2,callback);        //一秒之后开始进行坐标转换。参数2,表示是从GCJ-02坐标到百度坐标。参数0,表示是从GPS到百度坐标
        }, 1000);
    </script>
    View Code

    这是加载百度地图静态源码

  • 相关阅读:
    List分组和排序
    IOS 可靠性测试 iosMonkey
    Mac 10.10 下安装jdk 1.7 以上
    Ubuntu 无法拖拽复制
    Ubuntu 环境安装整理
    vmware 中 ubuntu linux 安装vmware tools
    Vmware linux 安装 Vmware Tools 提示只读
    Ubuntu_文件夹名字转化成英文
    Ubuntu_开启root 登陆
    Tomcat 用户配置
  • 原文地址:https://www.cnblogs.com/tong775131501/p/4122485.html
Copyright © 2020-2023  润新知