西部数据网站管理助手,专业建设 验收 网站,wordpress花园主题,网络营销期末考试题库有个业务场景#xff0c;需要根据获取到的地图区域显示#xff0c;根据相应的经纬度反查 左侧区域的会议室。思路#xff1a;1.得到百度地图可视区域--可视区域的中心点2.可视区域的四个角的其中两个(东北角西南角)http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_refer…有个业务场景需要根据获取到的地图区域显示根据相应的经纬度反查 左侧区域的会议室。思路1.得到百度地图可视区域--可视区域的中心点2.可视区域的四个角的其中两个(东北角西南角)http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html#a1b2getSouthWest()Point返回矩形区域的西南角getNorthEast()Point返回矩形区域的东北角getCenter()Point返回矩形的中心点在 map初始化 自定义的方法 setMapEvent() 集中声明map.addEventListener(zoomend,function(evt){console.log(#zoomend##this.getCenter().lng ---this.getCenter().lat);var bound this.getBounds();console.log(getSouthWest %bound.getSouthWest().lng lat: bound.getSouthWest().lat);console.log(NorthEast %bound.getNorthEast().lng lat: bound.getNorthEast().lat);console.log(this.getCenter().lng ---this.getCenter().lat);});map.addEventListener(moveend,function(evt){console.log(#zoomend##this.getCenter().lng ---this.getCenter().lat);var bound this.getBounds();//console.log($$$$$moveend bound.getCenter());console.log(moveend getSouthWest %bound.getSouthWest().lng lat: bound.getSouthWest().lat);console.log(moveend NorthEast %bound.getNorthEast().lng lat: bound.getNorthEast().lat);console.log(this.getCenter().lng ---this.getCenter().lat);});这样就能获取视图范围内的经纬度范围数据.