get_image_layer: Retrieve an image service layer from an ArcGIS REST API

View source: R/retrieve_layers.R

get_image_layerR Documentation

Retrieve an image service layer from an ArcGIS REST API

Description

This function retrieves image service layers from an ArcGIS REST services API and returns them as a RasterStack object

Usage

get_image_layer(
  url,
  sf_object = NULL,
  bbox = NULL,
  bbox_crs = NULL,
  token = "",
  clip_raster = TRUE,
  format = "png",
  transparent = TRUE,
  ...
)

Arguments

url

A character string of the url for the layer to pull

sf_object

An sf object used for the bounding box

bbox

Vector of bounding box coordinates

bbox_crs

CRS for bbox (required if bbox is used)

token

A character string of the token (if needed)

clip_raster

Logical. Should the raster be clipped to contain only the pixels that reside in the sf_object? By default, ArcGIS returns some overlapping edge pixels. Setting clip_raster to TRUE (default) will remove these using mask from the raster package

format

The raster format desired. Default is "png"

transparent

Logical. Retrieve a raster with a transparent background (TRUE, default) or not (FALSE)

...

Additional arguments to pass to the ArcGIS REST API

Details

This is one of the core functions of the package. It retrieves image service layers from an ArcGIS REST API designated by the URL. These layers require a bounding box to query the map layer, which is either taken from the sf_object argument or optionally can be passed via the bbox argument. Either sf_object or bbox are optional, but one of them must be present.

All of the querying parameters are sent via a POST request to the URL, so if there are issues with passing additional parameters via ... first determine how they fit into the POST request and make adjustments as needed. This syntax can be tricky if you're not used to it.

Value

A "RasterStack" object

Examples

## Not run: 
wi_leaf_off_layer <- get_image_layer(wi_leaf_off_url, wis_poly)
plot_layer(wi_leaf_off_layer, outline_poly = wis_poly)

## End(Not run)

pfrater/arcpullr documentation built on March 16, 2024, 6:29 a.m.