| gp_params | R Documentation |
Functions for converting R objects to and from ArcGIS geoprocessing parameter types. These functions handle the serialization and parsing of various data types used in ArcGIS geoprocessing services.
parse_gp_feature_record_set(json)
as_gp_feature_record_set(x)
parse_gp_record_set(json)
as_record_set(x)
as_gp_raster_layer(x)
gp_linear_unit(distance = integer(0), units = character(0))
as_gp_linear_unit(x)
parse_gp_linear_unit(json)
gp_areal_unit(area = integer(0), units = character(0))
as_gp_areal_unit(x)
parse_gp_areal_unit(json)
as_gp_date(x)
parse_gp_date(json)
as_spatial_reference(x)
from_spatial_reference(sr, error_call = rlang::caller_call())
parse_spatial_reference(json)
from_envelope(x, error_call = rlang::caller_call())
json |
raw json to parse |
x |
the object to convert into json |
distance |
a scalar number of the distance. |
units |
the unit of the measurement. Must be one of "esriUnknownAreaUnits", "esriSquareInches", "esriSquareFeet", "esriSquareYards", "esriAcres", "esriSquareMiles", "esriSquareMillimeters", "esriSquareCentimeters", "esriSquareDecimeters", "esriSquareMeters", "esriAres", "esriHectares", "esriSquareKilometers", "esriSquareInchesUS", "esriSquareFeetUS", "esriSquareYardsUS", "esriAcresUS", "esriSquareMilesUS". |
area |
a scalar number of the measurement. |
sr |
a list with fields |
error_call |
the caller environment to be used when propagating errors. |
This package provides support for the following geoprocessing parameter types:
GPFeatureRecordSetLayer: Feature collections with geometry and attributes
GPRecordSet: Tabular data without geometry
GPRasterDataLayer: Raster datasets from Portal items, Image Servers, or URLs
GPLinearUnit: Linear distance measurements with units
GPArealUnit: Area measurements with units
GPDate: Date/time values in milliseconds since epoch
GPSpatialReference: Coordinate reference systems
The following types are planned for future implementation:
GPField: Field definitions with name, type, and properties
GPMultiValue: Arrays of values for a single data type
GPValueTable: Flexible table-like objects with rows and columns
GPComposite: Parameters that accept multiple data types
GPEnvelope: Bounding box extents (use as_extent() for GPExtent)
Most functions follow a consistent pattern:
as_gp_*(): Convert R objects to geoprocessing parameter JSON
parse_gp_*(): Parse geoprocessing response JSON to R objects
Constructor functions (e.g., gp_linear_unit(), gp_areal_unit()) create typed S7 objects
# Create a linear unit distance <- gp_linear_unit(distance = 100, units = "esriMeters") # Convert spatial data to feature record set as_gp_feature_record_set(my_sf_data) # Parse a geoprocessing response parse_gp_feature_record_set(response_json)
Other geoprocessing:
arc_form_params(),
arc_gp_job,
arc_job_status(),
gp_job_from_url()
# create a feature record set
fset <- as_gp_feature_record_set(iris[1,])
fset
# create fake gp feature record set to parse
fset_list <- list(
list(
dataType = "GPFeatureRecordSetLayer",
paramName = "example",
value = as_featureset(iris[1,])
)
)
# create the json
json <- yyjsonr::write_json_str(fset_list, auto_unbox = TRUE)
# parse the record set json
parse_gp_feature_record_set(json)
# linear units
lu <- gp_linear_unit(10, "esriMeters")
lu
as_gp_linear_unit(lu)
# areal units
au <- gp_areal_unit(10, "esriSquareMeters")
au
as_gp_areal_unit(au)
# dates
json <- r"({
"paramName": "Output_Date",
"dataType": "GPDate",
"value": 1199145600000
})"
parse_gp_date(json)
sr <- list(wkid = 4326L)
from_spatial_reference(sr)
x <- list(
xmin = -122.4195,
ymin = 37.330219000000056,
xmax = -122.030757,
ymax = 37.77650360000007,
spatialReference = list(wkid = 4326L, latestWkid = 4326L)
)
from_envelope(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.