These helpers provide easy access to the layers contained in a
FeatureServer, MapServer, or GroupLayer.
Usage
get_layer(x, id = NULL, name = NULL, token = arc_token())
get_all_layers(x, token = arc_token())
get_layers(x, id = NULL, name = NULL, token = arc_token())Arguments
- x
an object of class
FeatureServer,MapServer, orGroupLayer.- id
default
NULL. A numeric vector of unique ID of the layer you want to retrieve. This is a scalar inget_layer().- name
default
NULL. The name associated with the layer you want to retrieve.nameis mutually exclusive withid. This is a scalar inget_layer().- token
an
httr2_tokenas created byauth_code()or similar
Value
get_layer()returns a singleFeatureLayerorTablebased on its IDget_layers()returns a list of the items specified by theidornameargumentget_all_layers()returns a namedlistwith an elementlayersandtables. Each a list containingFeatureLayerandTables respectively.
Details
The id and name arguments must match the field values of the respective names as seen in the output of list_items()
Examples
if (FALSE) { # \dontrun{
# FeatureServer
furl <- paste0(
"https://services3.arcgis.com/ZvidGQkLaDJxRSJ2/arcgis/rest/services/",
"PLACES_LocalData_for_BetterHealth/FeatureServer"
)
fserv <- arc_open(furl)
fserv
get_layer(fserv, 0)
get_layers(fserv, name = c("Tracts", "ZCTAs"))
get_all_layers(fserv)
} # }