as_layer {arcgisutils} | R Documentation |
Create Esri layer objects
Description
These functions are used to generate list objects that can be converted into json objects that are used in REST API requests. Notably they are used for adding R objects as items to a portal.
Usage
as_layer(
x,
name,
title,
layer_definition = as_layer_definition(x, name, "object_id", infer_esri_type(x)),
id = NULL,
layer_url = NULL,
legend_url = NULL,
popup_info = NULL,
call = rlang::caller_env()
)
as_layer_definition(
x,
name,
object_id_field,
fields = infer_esri_type(x),
display_field = NULL,
drawing_info = NULL,
has_attachments = FALSE,
max_scale = 0,
min_scale = 0,
templates = NULL,
type_id_field = NULL,
types = NULL,
call = rlang::caller_env()
)
as_feature_collection(
layers = list(),
show_legend = TRUE,
call = rlang::caller_env()
)
Arguments
x |
an object of class |
name |
a scalar character of the name of the layer. Must be unique. |
title |
A user-friendly string title for the layer that can be used in a table of contents. |
layer_definition |
a layer definition list as created by |
id |
A number indicating the index position of the layer in the WMS or map service. |
layer_url |
default |
legend_url |
default |
popup_info |
default |
call |
The execution environment of a currently running
function, e.g. You only need to supply Can also be For more information about error calls, see Including function calls in error messages. |
object_id_field |
a scalar character vector indicating the name of the object ID field in the dataset. |
fields |
a data.frame describing the fields in |
display_field |
default |
drawing_info |
default |
has_attachments |
default |
max_scale |
default |
min_scale |
default |
templates |
default |
type_id_field |
default |
types |
An array of type objects available for the dataset.
This is used when the |
layers |
a list of layers as created by |
show_legend |
default |
Details
A featureCollection
defines a layer of features that will be stored on a web map.
It consists of an array of layer
s. The layer
contains the features
(attributes and geometries) as a featureSet
(see as_esri_featureset()
) and
additional metadata which is stored in the layerDefinition
object. The
layerDefinition
most importantly documents the fields in the object, the object ID,
and additional metadata such as name, title, and display scale.
Additional documentation for these json object:
Value
A list object containing the required fields for each respective json type.
The results can be converted to json using jsonify::to_json(x, unbox = TRUE)
Examples
ld <- as_layer_definition(iris, "iris", "objectID")
l <- as_layer(iris, "iris name", "Iris Title")
fc <- as_feature_collection(layers = list(l))