• 百度地图api实例


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm11.aspx.cs" Inherits="JQGridExercise.WebForm11" %>

    <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{ 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}
    #allmap {100%;height:500px;}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=63i90lOgvKon1KU0AnLGgGkC"></script>
    <title>逆地址解析</title>
    </head>
    <body>
    <div id="allmap" style="1200px;height:600px;"></div>
    <p>点击地图展示详细地址</p>
    </body>
    </html>
    <script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    var point = new BMap.Point(116.331398, 39.897445);
    map.centerAndZoom(point, 12);
    map.enableScrollWheelZoom(true);
    var geoc = new BMap.Geocoder();
    map.addControl(new BMap.NavigationControl({ anchor: BMAP_ANCHOR_TOP_RIGHT, offset: new BMap.Size(40, 60) })); // 添加平移缩放控件
    var pointArray = new Array();
    map.addEventListener("click", function (e) {
    var pt = e.point;
    var pointArray = new Array();
    var marker = new BMap.Marker(new BMap.Point(e.point.lng, e.point.lat)); // 创建点
    map.addOverlay(marker); //增加点
    pointArray[0] = new BMap.Point(e.point.lng, e.point.lat);
    //marker.addEventListener("click", attribute);


    geoc.getLocation(pt, function (rs) {

    var addComp = rs.addressComponents;
    //alert(e.point.lng + ", " + e.point.lat);
    alert(rs.address);
    });
    });
    </script>

  • 相关阅读:
    装饰器
    目录和文件操作
    网络通信过程
    epoll并发
    laravel(包含lumen)框架中的跨域函数实例
    windows使用nginx
    nginx反向代理配置 其实很简单
    前端html页面使用marked点亮你的代码
    PHPWAMP开启SSL,PHPWAMP配置ssl证书
    php接收并存储base64位字符串图片
  • 原文地址:https://www.cnblogs.com/honghong75042/p/4634894.html
Copyright © 2020-2023  润新知