The arc_gp_job
class is used to interact with Geoprocessing Services in
ArcGIS 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
The arc_gp_job
uses S7 classes for the job request parameters and job status
via arc_form_params()
and arc_job_status()
respectively. Importantly,
arc_form_params()
ensures that parameters provided to a geoprocessing
service 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_url
the URL of the job service (without
/submitJob
)id
the ID of the started job.
NULL
self$start()
has not been called.
Active bindings
params
returns an S7 object of class
arc_form_params
(seearc_form_params()
) the list can be accessed viaself$params@params
.status
returns 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.results
returns the current results of the job by querying the
/jobs/{job-id}/results
endpoint.
Methods
Method new()
Usage
arc_gp_job$new(
base_url,
params = list(),
result_fn = NULL,
token = arc_token(),
error_call = rlang::caller_call()
)
Arguments
base_url
the URL of the job service (without
/submitJob
)params
a named list where each element is a scalar character
result_fn
Default
NULL
. An optional function to apply to the results JSON. By default parses results usingRcppSimdJson::fparse()
.token
default
arc_token()
. The token to be used with the job.error_call
default
rlang::caller_call()
the calling environment.
Method start()
Starts the job by calling the /submitJob
endpoint. This also sets the public field id
.
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 class
params <- job$params
params
#> <arcgisutils::arc_form_params>
#> @ params:List of 1
#> .. $ f: chr "json"
# view underlying list
params@params
#> $f
#> [1] "json"
#>