GP服务调用

1.引入 "esri/tasks/Geoprocessor"

2.new GP服务,根据提交参数调用gp

const gp =new this.$esri.Geoprocessor({

url: layerUrl.YTH_HYDRODYNAMIC_GP

})

const jobInfo =await gp.submitJob({

input: {

url: ascFileUrl,

format:'.asc'

    }

})

3. 关闭组件时停止调用 GP 服务

let flag =true // 避免 GP 服务执行完成后调用 cancelJob 报错

this.$once('hook:beforeDestroy', () => {

flag &&gp.cancelJob(jobInfo.jobId)

})

4. 处理 GP 服务调用结果

const jobInfo2 =await gp.waitForJobCompletion(jobInfo.jobId)

const resultLayer =await gp.getResultMapImageLayer(jobInfo2.jobId)

5.完成GP服务调用,结果图层添加到地图

this.$mapView.map.add(resultLayer,1)

flag =false

6.清除图层

(1)直接添加地图

this.mapView2.map?.removeAll()

(2)添加到地图组layer

const layer =this.cardForecastGroupLayer.findLayerById(this.deleteId)

this.cardForecastGroupLayer.remove(layer)

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容