Create a Geoprocessing Service Job
Thearc_gp_job class is used to interact with Geoprocessing Services inArcGIS Online and Enterprise.
Arguments
- base_url
the URL of the job service (without
/submitJob)- params
a named list where each element is a scalar character
- token
default
arc_token(). The token to be used with the job.
Details
Thearc_gp_job uses S7 classes for the job request parameters and job statusviaarc_form_params() andarc_job_status() respectively. Importantly,arc_form_params() ensures that parameters provided to a geoprocessingservice are all character scalars as required by the form body.
See also
Other geoprocessing:arc_form_params(),arc_job_status(),gp_params
Public fields
base_urlthe URL of the job service (without
/submitJob)idthe ID of the started job.
NULLself$start()has not been called.
Active bindings
paramsreturns an S7 object of class
arc_form_params(seearc_form_params()) the list can be accessed viaself$params@params.statusreturns the status of the geoprocessing job as an S7 object of class
gp_job_status(seearc_job_status()) by querying the/jobs/{job-id}endpoint.resultsreturns the current results of the job by querying the
/jobs/{job-id}/resultsendpoint.
Methods
Methodnew()
Usage
arc_gp_job$new(base_url, params=list(), result_fn=NULL, token=arc_token(), error_call=rlang::caller_call())Arguments
base_urlthe URL of the job service (without
/submitJob)paramsa named list where each element is a scalar character
result_fnDefault
NULL. An optional function to apply to the results JSON. By default parses results usingRcppSimdJson::fparse().tokendefault
arc_token(). The token to be used with the job.error_calldefault
rlang::caller_call()the calling environment.
Methodstart()
Starts the job by calling the/submitJob endpoint. This also sets the public fieldid.
Examples
url<-paste0("https://logistics.arcgis.com/arcgis/","rest/services/World/ServiceAreas/","GPServer/GenerateServiceAreas")job<-new_gp_job(url,list(f="json"))job#> <arc_gp_job>#> Job ID: not initiated#> Status: not started#> Resource: /GenerateServiceAreas#> Params:#> • f# extract params S7 classparams<-job$paramsparams#> <arcgisutils::arc_form_params>#> @ params:List of 1#> .. $ f: chr "json"# view underlying listparams@params#> $f#> [1] "json"#>