账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    高德地图引入遮罩后获取地区数据的时候遮罩又消失了,为什么尼?
    56
    0
    引入遮罩的目的是为了地图只显示中国区域,但遮罩是可以正常覆盖掉中国地图外其他区域的,但获取到了接口数据,将全国各地的数据渲染到地图上面后,遮罩就整体消失了,为什么尼?图一:遮罩效果:图二:获取到数据后遮罩消失了:期望的效果是:遮罩成功遮住中国地图以外的地图,但中国地图各区域的数据也能正常显示。代码:// 初始化地图相关实例 initMap() { const that = this; lazyAMapApiLoaderInstance.load().then(() => { new AMap.DistrictSearch({ extensions: "all", subdistrict: 0 }).search("中国", function(status, result) { // 外多边形坐标数组和内多边形坐标数组 var outer = [ new AMap.LngLat(-360, 90, true), new AMap.LngLat(-360, -90, true), new AMap.LngLat(360, -90, true), new AMap.LngLat(360, 90, true) ]; var holes = result.districtList[0].boundaries; var pathArray = [outer]; pathArray.push.apply(pathArray, holes); var polygon = new AMap.Polygon({ pathL: pathArray, strokeColor: "#00eeff", strokeWeight: 1, fillColor: "#71B3ff", fillOpacity: 0.9 }); polygon.setPath(pathArray); console.log(polygon, "polygon"); that.map.add(polygon); that.setMapData("", "", ""); // 此方法为获取后端数据渲染各地区的数量 }); that.map = new AMap.Map("container", { zoom: 4.5, center: [113.612427, 36.303573], mapStyle: "amap://styles/whitesmoke" }); // that.setMapData('','',''); }); },
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    网站公告
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部