aaronyang的百度地图API之LBS云[把数据丰富显示1/3]

中国的IT 需要无私分享和贡献的人,一起努力


 

本篇博客来自地址:http://www.cnblogs.com/AaronYang/p/3673933.html,请支持原创,未经允许不许转载

一、第一步

  默认我们显示我们leverTerminal表中所有信息,使用云麻点图模式显示

 1.1我们添加一个新的页面MaDian

<h1>第三课 POI数据检索-麻点地图</h1>
@section BaiduApi{
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=你的ak"></script>
}
<br />
<div>
    搜索条件
</div>
<br/>
<div id="container" style="width:100%;height:500px;"></div>


<script type="text/javascript">
    var map = new BMap.Map("container");          // 创建地图实例
    map.centerAndZoom(new BMap.Point(117.234963, 31.858815), 15);// 初始化地图,设置中心点坐标和地图级别          
    map.enableScrollWheelZoom();
    map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件

    var customLayer;
    function addCustomLayer(keyword) {
        if (customLayer) {
            map.removeTileLayer(customLayer);
        }
        customLayer = new BMap.CustomLayer({
            geotableId: 59897,
            q: keyword, //检索关键字
            tags: '', //空格分隔的多字符串
            filter: '' //过滤条件,参考http://developer.baidu.com/map/lbs-geosearch.htm#.search.nearby
        });
        map.addTileLayer(customLayer);
        customLayer.addEventListener('hotspotclick', callback);
    }
    addCustomLayer('');

    function callback(e)//单击热点图层
    {
        var customPoi = e.customPoi;//poi的默认字段
        var contentPoi = e.content;//poi的自定义字段  
    }
</script>

代码的js部分,这里有个geotableId的设置,我的LBS上leverterminal的表的ID是59897

OK,默认我们显示所有的这张表上的手机用户信息,F5运行,效果如下






文章已经迁移到: http://www.ayjs.net/post/102.html

 



中国的IT 需要无私分享和贡献的人,一起努力 AaronYang 2014年

 

 

posted @ 2014-04-18 18:52  AYUI框架  阅读(2574)  评论(6编辑  收藏  举报