Skip to contents

This function connects to an ESRI Feature Service, displays available layers if no ID is provided, and allows users to download and query a specific layer.

Usage

load_esri(furl, ..., id = NULL)

Arguments

furl

Character string. URL to the ESRI Feature Service endpoint.

...

Additional arguments passed to arcgislayers::arc_select for querying the layer.

id

Integer, optional. The ID of the layer to download. If NULL, available layers are displayed, and the user is prompted to specify an ID interactively.

Value

An sf object containing the queried features from the selected layer.

Details

The function opens a connection to the specified ESRI Feature Service, lists all available layers if no id is provided, and then downloads and queries the specified layer. Users can pass query arguments via ... to filter the results.

Examples

if (FALSE) { # \dontrun{
# Example 1: Load and query a specific layer by ID
sf_data <- load_esri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", id = 1)

# Example 2: Interactively select a layer
sf_data <- load_esri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer")
} # }