• 获取百度地图按条件查找的信息


    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <title>数据接口</title>
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
        <script src="http://fc.0372.cn/js/jquery-1.9.1.js" type="text/javascript"></script>
    </head>
    <body>
        <div style=" 520px; height: 340px; border: 1px solid gray" id="container">
        </div>
        <div id="results" style="font-size: 13px; margin-top: 10px;">
        </div>
        <div id="d">
        </div>
    </body>
    </html>
    <script type="text/javascript">
        var map = new BMap.Map("container");
        var options = {
            onSearchComplete: function (results) {
                // 判断状态是否正确
    
    
    
                if (local.getStatus() == BMAP_STATUS_SUCCESS) {
                    for (var i = 0; i < results.getNumPages(); i++) {
                        var s = [];
                        var n = results.getCurrentNumPois();
                        for (var i = 0; i < n; i++) {
                            var title = results.getPoi(i).title;
                            var address = results.getPoi(i).address;
                            //var phone = results.getPoi(i).phoneNumber;
                            var x = results.getPoi(i).point.lat;
                            var y = results.getPoi(i).point.lng;
                            $.post("GetGardenFromMap.ashx", { "title": title, "address": address,  "x": x, "y": y }, function (data,status) {
                                if ("success" == status) {
                                    //alert("ok");
                                }
                                else {
                                    alert("error");
                                }
    
                            });
                            //                     $.ajax({
                            //                         url: "map.ashx",
                            //                         data: { "title": title, "address": address, "phone": phone, "x": x, "y": y }
                            // 
                            //                     });
                            //s.push(title+", " + address + "," + phone + "," + x + "," + y + "个数" + results.getNumPois());
                            //alert(x);
                        }
                        alert(results.getPageIndex() + "/" + results.getNumPages() + "ok");
                        // document.getElementById("results").innerHTML = s.join("<br/>");
                    }
                }
            },
            renderOptions: {
                map: map,
                panel: "d"
    
            }
    
        };
        var local = new BMap.LocalSearch("安阳", options);
        local.setPageCapacity(100);
        local.search("小区");
    
    </script>
  • 相关阅读:
    C#发送Email邮件(实例:QQ邮箱和Gmail邮箱)
    MD5
    关节疼
    c#写入Mysql中文显示乱码 解决方法 z
    浅析基层检察院派驻乡镇检察室的健康发展 z
    查询数据库中所有名称相同的记录
    一个简单功能的SQL 实现
    java 的""和null的区别
    java 的 &和&&的区别
    mysql left join,right join,inner join的区别
  • 原文地址:https://www.cnblogs.com/xuhongfei/p/3431689.html
Copyright © 2020-2023  润新知