当前位置: 首页 > Web前端 > vue.js

arcgisforjs实现图层截图

时间:2023-03-31 23:03:12 vue.js

鏈€杩戦亣鍒颁竴涓渶姹傦紝闇€瑕佹樉绀簃apserver鍥惧眰鐨勬埅鍥撅紝骞朵笂浼犲埌鍚庡彴鐢熸垚缂╃暐鍥撅紝鏂逛究鏁版嵁绠$悊銆傪煈夌湅浜嗘枃妗o紝鍐冲畾浣跨敤takeScreenshot鐨刟pi銆備笅闈㈡槸姝ラ锛?.鍔犺浇鍥惧眰2.鍘熶綔鑰呭湴鍧€馃憞馃憞馃憞https://segmentfault.com/u/yo...3.refs鎸囧悜鐨勫湴鍥剧粍浠讹紝mapPointMax锛宮apPointMin杩欓噷鎴戠敤鐨勬槸Xmin,Xmax,Ymin,Ymax.area鍦ㄥ浘灞俵ayerfullExtent20鍜?0鎸囩殑鏄敓鎴愬浘鐗囨埅鍥剧殑瀹介珮(){letmapPointMax={x:105.31229705386276,y:28.671804706649198,spatialReference:{wkid:4490}}letmapPointMin={x:102.8696857221264,y:26.536026998547992,spatialReference:{wkid:4490}}letscreenPointmax=this.$refs.arcgismap.view.toScreenscreenPointmin=this.$refs.arcgismap.view.toScreen(mapPointMin)//screenPoint=MapView.toScreen([this.buffer.extent.xmax,this.buffer.extent.ymax])//console.log(screenPoint)letarea={x:Math.min(screenPointmin.x,screenPointmax.x)-20,y:Math.min(screenPointmin.y,screenPointmax.y)-20,瀹藉害:Math.abs(screenPointmax.x-screenPointmin.x)+40,楂樺害:Math.abs(screenPointmax.y-screenPointmin.y)+40}this.proportion=(Math.abs(screenPointmax.y-screenPointmin.y)+40)/(Math.abs(screenPointmax.x-screenPointmin.x)+40)杩欎釜銆俻roportion=this.proportion.toString()this.$refs.arcgismap.view.takeScreenshot({area:area,format:'png'}).then((screenshot)=>{this.dataUrl=screenshot.dataUrl鎺у埗鍙般€俵og(screenshot.dataUrl);})}锛屽鏈夐敊璇鎸囨锛岃阿璋?/p>