Class: GeoprocessingService

GeoprocessingService

处理自动化服务接口类。

new GeoprocessingService(url, options)

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/leaflet/iclient-leaflet.js"></script>
<script>
  new L.supermap.GeoprocessingService(url, options);
  
  // 弃用的写法
  L.supermap.geoprocessingService(url, options);
  
</script>

// ES6 Import
import { GeoprocessingService } from '@supermap/iclient-leaflet';

new GeoprocessingService(url, options);

leaflet/services/GeoprocessingService.js, line 6
Name Type Description
url string

服务地址。

options Object

参数。

Version:
  • 10.1.0
Example
//为了安全访问受保护的处理自动化服务,必须通过传递 iserver 令牌( token ),才能正确访问相关资源。
SecurityManager.registerToken(serviceUrl, token);
 var geoprocessingService = new GeoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
        geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
            console.log(serverResult.result);
            var jobID = serverResult.result.jobID;
            var options = {
                interval: 5000,
                statusCallback: function(state) {
                    console.log("Job Status: ", state);
                }
            };
            geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
                console.log(serverResult);
            })
        })

Extends

Events

inherited destroy

leaflet/services/ServiceBase.js, line 52

资源释放成功后触发。

Properties:
Name Type Description
this ServiceBase

this 对象。

inherited initialized

leaflet/services/ServiceBase.js, line 39

构造函数构造成功后触发。

Properties:
Name Type Description
this ServiceBase

this 对象。

Methods

cancelJob(identifier, jobId, callback){Promise}

leaflet/services/GeoprocessingService.js, line 127

取消处理自动化任务的异步执行。

Name Type Description
identifier string

处理自动化工具 ID。

jobId string

处理自动化任务 ID。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

inherited destroy()

leaflet/services/ServiceBase.js, line 47

释放资源,将引用的资源属性置空。

execute(identifier, parameter, environment, callback){Promise}

leaflet/services/GeoprocessingService.js, line 74

同步执行处理自动化工具。

Name Type Description
identifier string

处理自动化工具 ID。

parameter Object

处理自动化工具的输入参数。

environment Object

处理自动化工具的环境参数。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

getJobInfo(identifier, jobId, callback){Promise}

leaflet/services/GeoprocessingService.js, line 115

获取处理自动化任务的执行信息。

Name Type Description
identifier string

处理自动化工具 ID。

jobId string

处理自动化任务 ID。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

getJobs(identifier, callback){Promise}

leaflet/services/GeoprocessingService.js, line 139

获取处理自动化服务任务列表。

Name Type Description
identifier string

处理自动化工具 ID。(传参代表 identifier 算子的任务列表,不传参代表所有任务的列表)

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

getResults(identifier, jobId, filter, callback){Promise}

leaflet/services/GeoprocessingService.js, line 150

处理自动化工具异步执行的结果,支持结果过滤。

Name Type Description
identifier string

处理自动化工具 ID。

jobId string

处理自动化任务 ID。

filter string

输出异步结果的 ID。(可选,传入 filter 参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

getTool(identifier, callback){Promise}

leaflet/services/GeoprocessingService.js, line 63

获取工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。

Name Type Description
identifier string

处理自动化工具ID。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

getTools(callback){Promise}

leaflet/services/GeoprocessingService.js, line 53

获取处理自动化工具列表。

Name Type Description
callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

submitJob(identifier, parameter, environment, callback){Promise}

leaflet/services/GeoprocessingService.js, line 87

异步执行处理自动化工具。

Name Type Description
identifier string

处理自动化工具ID。

parameter Object

处理自动化工具的输入参数。

environment Object

处理自动化工具的环境参数。

callback RequestCallback 可选

回调函数,该参数未传时可通过返回的 promise 获取结果。

Returns:
Type Description
Promise Promise 对象。

waitForJobCompletion(jobId, identifier, options, callback){Promise}

leaflet/services/GeoprocessingService.js, line 100

获取处理自动化异步执行状态信息。

Name Type Description
jobId string

处理自动化任务ID。

identifier string

处理自动化工具ID。

options Object

参数。

Name Type Description
interval number

定时器时间间隔。

statusCallback RequestCallback

任务状态的回调函数。

callback function

回调函数。

Returns:
Type Description
Promise Promise 对象。