Skip to contents

add_definition() and update_definition() support adding or updating definition properties for a hosted Feature Service or Feature Layer. delete_definition() supports deleting a definition. Examples of properties include the layer name, renderer, or field properties. Named parameters passed to ... must have names matching supported definitions. Parameters are converted to a JSON addToDefinition, updateDefinition, or deleteFromDefinition query parameter using jsonify::to_json().

Usage

add_definition(x, ..., async = FALSE, token = arc_token())

update_definition(x, ..., async = FALSE, token = arc_token())

delete_definition(x, ..., async = FALSE, token = arc_token())

Arguments

x

A Feature Layer, Table, or Feature Service class object.

...

Additional parameters for the "addToDefinition" or "updateDefinition" body of the request.

async

Default FALSE. If TRUE, support asynchronous processing for the request.

token

your authorization token.

Value

If async = FALSE, return an updated "FeatureServer" or "FeatureLayer" object with the added, updated, or deleted definitions. If async = TRUE, the input Feature Layer or Feature Server object x is returned as is.

Details

See the ArcGIS REST API documentation on Administer Hosted Feature Services for more details:

Examples

if (interactive()) {
# authenticate
set_arc_token(auth_code())

# publish a layer
published <- publish_layer(iris, "Iris Test")

iris_fl <- arc_open(published$services$encodedServiceURL) |>
  get_layer(0)

# Update the name of the layer
update_definition(
  iris_fl,
  name = "New Layer Name"
)

# add an index on the the layer
add_definition(
  penguin_fl,
  indexes = list(
    name = "index1",
    fields = "Species",
    isUnique = FALSE,
    isAscending = FALSE,
    description = "Example index"
  )
)

# refresh the layer to get the updates
iris_fl <- refresh_layer(pengiris_flin_fl)
iris_fl[["indexes"]]
}