浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。

文档全面上新

更科技的视觉体验,更高效的页面结构,快前往体验吧!

体验新版
(以“<div id="examples_api_center"><div class="title-hd">POI综合检索</div></div><div class="demos_wrap"><div class="header"><div class="active">功能场景</div></di...”为内容创建页面)
 
第1行: 第1行:
<div id="examples_api_center"><div class="title-hd">POI综合检索</div></div><div class="demos_wrap"><div class="header"><div class="active">功能场景</div></div><div class="wrap-mi">该示例介绍如何自定义地图样式。</div><div class="header"><div class="active">DEMO</div></div><div class="andiord-wrap wrap"><div class="wrap-wp"><div class="pc-video"><div class="video-box infor"><div class="video-control1"></div><pre>https://mapopen-website-wiki.cdn.bcebos.com/wiki/android-loc-sdk/sdkgetAK.mov</pre>
+
<div id="examples_api_center"><div class="title-hd">POI综合检索</div></div><div class="demos_wrap"><div class="header"><div class="active">功能场景</div></div><div class="wrap-mi">该示例展示了以“行政区划”、“周边”、“视野范围”三种类型的POI检索。</div><div class="header"><div class="active">DEMO</div></div><div class="andiord-wrap wrap"><div class="wrap-wp"><div class="pc-video"><div class="video-box infor"><div class="video-control1"></div><pre>https://mapopen-website-wiki.cdn.bcebos.com/wiki/android-loc-sdk/sdkgetAK.mov</pre>
</div><div class="video-title1">白天模式与黑夜模式切换</div></div></div><div class="api-table-box"><div class="api-info-box"><div class="pre-nav"><div class="left-icon"></div><div>核心接口</div><br/></div>
+
</div><div class="video-title1">POI综合检索</div></div></div><div class="api-table-box"><div class="api-info-box"><div class="pre-nav"><div class="left-icon"></div><div>核心接口</div><br/></div>
 
{| width="370" border="1"
 
{| width="370" border="1"
 
|-
 
|-
第8行: 第8行:
 
| width="90" | '''参考文档'''
 
| width="90" | '''参考文档'''
 
|-
 
|-
| Map
+
| Boundary
| new BMapGL.Map('container')
+
| bd.get(city,function)
| 创建GL版地图
+
| 获取行政区域
| [[jspopularGL/guide/show|展示地图]]
+
| 暂无
 
|-
 
|-
| Map
+
| Polygon
| setMapType(BMAP_EARTH_MAP)
+
| new BMapGL.Polygon(points,opts)
| 设置地图类型
+
| 多边形绘制行政区域
| [[jspopularGL/guide/maptype|变更地图类型]]
+
| [[jspopularGL/guide/addOverlay|绘制点、线、面]]
 +
|-
 +
| Geocoder
 +
| geo.getPoint(city, function)
 +
| 根据城市获取地图范围
 +
| 暂无
 +
|-
 +
| LocalSearch
 +
| local.search(srchvalue, point, 1000)
 +
| 检索
 +
| 暂无
 
|}
 
|}
</div></div><div class="header"><div class="active">核心代码</div></div><div class="pre-wrap"><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint prettyprinted pre-and"> <div id="container"></div>
+
</div></div><div class="header"><div class="active">核心代码</div></div><div class="pre-wrap"><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint prettyprinted pre-and">           /**
  <ul class="drawing-panel" style="z-index: 99;">
+
            * 行政区划内搜索
      <li class = "normal btn current" onclick = "changeMapType(this)">3D地图</li>
+
          */
      <li class = "earth btn" onclick = "changeMapType(this)">卫星地球</li>
+
          function switchBoundry() {
  </ul>
+
              function getBoundary() {
 
+
                  var bdary = new BMapGL.Boundary();
  <script>
+
                  bdary.get(configs.city, function (rs) { // 获取行政区域
  var map = new BMapGL.Map('container');
+
                      map.clearOverlays();
  map.centerAndZoom(new BMapGL.Point(116.404, 39.915), 18); // 设置中心点和地图级别
+
                      var count = rs.boundaries.length; // 行政区域的点有多少个
  map.enableScrollWheelZoom(true);                           // 开启鼠标滚轮缩放   
+
                      if (count === 0) {
  map.addControl(new BMapGL.NavigationControl3D());         // 添加3D控件
+
                          alert('未能获取当前输入行政区域');
  function changeMapType(e) {
+
                          return;
      if (e.className.indexOf('current') === -1) {
+
                      }
          var allLi = document.getElementsByClassName('btn');
+
                      var pointArray = [];
          for (var i = 0; i < allLi.length; i++) {
+
                      for (var i = 0; i < count; i++) {
              allLi[i].className = allLi[i].className.replace(' current','').trim();
+
                          var ply = new BMapGL.Polygon(rs.boundaries[i], {strokeWeight: 2, strokeColor: '#f00'}); // 建立多边形覆盖物
          }
+
                          map.addOverlay(ply);
          e.className += ' current';
+
                          pointArray = pointArray.concat(ply.getPath());
          if (e.className.indexOf('normal')&nbsp;!= -1) {
+
                      }
              map.setMapType(BMAP_NORMAL_MAP);
+
                      map.setViewport(pointArray); // 调整视野
          } else {
+
                  });
              map.setMapType(BMAP_EARTH_MAP);
+
              }
          }
+
              var geo = new BMapGL.Geocoder();
      }
+
              geo.getPoint(configs.city, function (point) {
  }
+
                  if (point) {
  </script>
+
                      var local = new BMapGL.LocalSearch(configs.city, {
 +
                          renderOptions: {map: map}
 +
                      });
 +
                      local.search(configs.srchvalue, point, 1000);
 +
                  } else {
 +
                      console.log('选择的城市有误');
 +
                  }
 +
              });
 +
              setTimeout(function () {
 +
                  getBoundary();
 +
              }, 0);
 +
          }
 +
     
 +
          /**
 +
            * 周边搜索(圆形区域检索)
 +
          */
 +
          function switchNearby() {
 +
              map.clearOverlays();
 +
              var mylocation = new BMapGL.Geolocation();
 +
              mylocation.getCurrentPosition(function (rs) {
 +
                  if (this.getStatus() === BMAP_STATUS_SUCCESS) {
 +
                      map.clearOverlays();
 +
                      map.panTo(rs.point);
 +
                      var point = rs.point;
 +
                      var circle = new BMapGL.Circle(point, 5000, {
 +
                          fillColor: 'blue',
 +
                          strokeWeight: 1,
 +
                          fillOpacity: 0.2,
 +
                          strokeOpacity: 0.3
 +
                      });
 +
                      map.addOverlay(circle);
 +
                      var local = new BMapGL.LocalSearch(point, {
 +
                          renderOptions: {map: map}
 +
                      });
 +
                      local.searchNearby(configs.srchvalue, point, 5000);
 +
                  }
 +
              });
 +
          }
 +
     
 +
          /**
 +
            * 视野范围内搜索(矩形区域检索)
 +
          */
 +
          function switchViewport() {
 +
              map.clearOverlays();
 +
              var bounds = map.getBounds(); // 返回地图可视区域
 +
              var local = new BMapGL.LocalSearch(map, {
 +
                  renderOptions: {map: map}
 +
              });
 +
              var pStart = new BMapGL.Point(bounds.sw.lng, bounds.sw.lat);
 +
              var pEnd = new BMapGL.Point(bounds.ne.lng, bounds.ne.lat);
 +
              var bs = new BMapGL.Bounds(pStart, pEnd);
 +
              local.searchInBounds(configs.srchvalue, bs);
 +
          }
 +
          /**
 +
            * 点击搜索按钮
 +
            */
 +
            function seachResult() {
 +
                var value = document.getElementById('srchinput').value;
 +
                configs.srchvalue = value&nbsp;? value&nbsp;: configs.srchvalue;
 +
                var city = document.getElementById('citySelect').value;
 +
                configs.city = city&nbsp;? city&nbsp;: configs.city;
 +
                switch (configs.checkTab) {
 +
                    case 0:
 +
                        switchBoundry();
 +
                        break;
 +
                    case 1:
 +
                        switchNearby();
 +
                        break;
 +
                    case 2:
 +
                        switchViewport();
 +
                        break;
 +
                }
 +
            }
 
                 </pre>
 
                 </pre>
 
<div class="pre-btn"><div class="pre-btn-copy-and">复制</div><div class="pre-btn-cb-and">深色</div></div><div class="success">复制成功</div></div></div></div></div>
 
<div class="pre-btn"><div class="pre-btn-copy-and">复制</div><div class="pre-btn-cb-and">深色</div></div><div class="success">复制成功</div></div></div></div></div>

2020年10月9日 (五) 15:13的版本

POI综合检索
功能场景
该示例展示了以“行政区划”、“周边”、“视野范围”三种类型的POI检索。
DEMO
https://mapopen-website-wiki.cdn.bcebos.com/wiki/android-loc-sdk/sdkgetAK.mov
POI综合检索
核心接口

接口 描述 参考文档
Boundary bd.get(city,function) 获取行政区域 暂无
Polygon new BMapGL.Polygon(points,opts) 多边形绘制行政区域 绘制点、线、面
Geocoder geo.getPoint(city, function) 根据城市获取地图范围 暂无
LocalSearch local.search(srchvalue, point, 1000) 检索 暂无
核心代码
            /**
            * 行政区划内搜索
           */
           function switchBoundry() {
               function getBoundary() {
                   var bdary = new BMapGL.Boundary();
                   bdary.get(configs.city, function (rs) { // 获取行政区域
                       map.clearOverlays();
                       var count = rs.boundaries.length; // 行政区域的点有多少个
                       if (count === 0) {
                           alert('未能获取当前输入行政区域');
                           return;
                       }
                       var pointArray = [];
                       for (var i = 0; i < count; i++) {
                           var ply = new BMapGL.Polygon(rs.boundaries[i], {strokeWeight: 2, strokeColor: '#f00'}); // 建立多边形覆盖物
                           map.addOverlay(ply);
                           pointArray = pointArray.concat(ply.getPath());
                       }
                       map.setViewport(pointArray); // 调整视野
                   });
               }
               var geo = new BMapGL.Geocoder();
               geo.getPoint(configs.city, function (point) {
                   if (point) {
                       var local = new BMapGL.LocalSearch(configs.city, {
                           renderOptions: {map: map}
                       });
                       local.search(configs.srchvalue, point, 1000);
                   } else {
                       console.log('选择的城市有误');
                   }
               });
               setTimeout(function () {
                   getBoundary();
               }, 0);
           }
       
           /**
            * 周边搜索(圆形区域检索)
           */
           function switchNearby() {
               map.clearOverlays();
               var mylocation = new BMapGL.Geolocation();
               mylocation.getCurrentPosition(function (rs) {
                   if (this.getStatus() === BMAP_STATUS_SUCCESS) {
                       map.clearOverlays();
                       map.panTo(rs.point);
                       var point = rs.point;
                       var circle = new BMapGL.Circle(point, 5000, {
                           fillColor: 'blue',
                           strokeWeight: 1,
                           fillOpacity: 0.2,
                           strokeOpacity: 0.3
                       });
                       map.addOverlay(circle);
                       var local = new BMapGL.LocalSearch(point, {
                           renderOptions: {map: map}
                       });
                       local.searchNearby(configs.srchvalue, point, 5000);
                   }
               });
           }
       
           /**
            * 视野范围内搜索(矩形区域检索)
           */
           function switchViewport() {
               map.clearOverlays();
               var bounds = map.getBounds(); // 返回地图可视区域
               var local = new BMapGL.LocalSearch(map, {
                   renderOptions: {map: map}
               });
               var pStart = new BMapGL.Point(bounds.sw.lng, bounds.sw.lat);
               var pEnd = new BMapGL.Point(bounds.ne.lng, bounds.ne.lat);
               var bs = new BMapGL.Bounds(pStart, pEnd);
               local.searchInBounds(configs.srchvalue, bs);
           }
           /**
            * 点击搜索按钮
            */
            function seachResult() {
                var value = document.getElementById('srchinput').value;
                configs.srchvalue = value ? value : configs.srchvalue;
                var city = document.getElementById('citySelect').value;
                configs.city = city ? city : configs.city;
                switch (configs.checkTab) {
                    case 0:
                        switchBoundry();
                        break;
                    case 1:
                        switchNearby();
                        break;
                    case 2:
                        switchViewport();
                        break;
                }
            }
                
复制
深色
复制成功
  • 文档根本没法用

  • 文档水平很差

  • 文档水平一般

  • 文档不错

  • 文档写的很好

如发现文档错误,或对此文档有更好的建议,请在下方反馈。问题咨询请前往反馈平台提交工单咨询。

提交反馈

拖动标注工具

添加矩形标注

添加箭头标注

完成

取消