zoukankan      html  css  js  c++  java
  • 获取百度地图按条件查找的信息

    <!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>
  • 相关阅读:
    OO&nbsp;ALV&nbsp;实现下拉框
    ABAP数据库修改字段(由其是主键)…
    使用Pattern调用自建的模板
    批次属性相关增强
    pyhton gevent库安装的蛋疼问题
    【转】Linux Crontab 定时任务 命令详解
    【转】windows下apache+wsgi+web.py环境搭建
    【转】PyScripter启动出错:Python could not be properly initialized. We must quit.
    cookie和session的区别
    无限极分类
  • 原文地址:https://www.cnblogs.com/xuhongfei/p/3431689.html
Copyright © 2011-2022 走看看