Skip to contents

This is an internal function to pull raster layers from either a map service or an image service of an ArcGIS REST API. This function is the engine that drives get_map_layer and get_image_layer

Usage

get_raster_layer(
  url,
  sf_object = NULL,
  bbox = NULL,
  token = "",
  clip_raster = TRUE,
  format = "png",
  transparent = TRUE,
  export_type = "map",
  add_legend = FALSE,
  ...
)

Arguments

url

A character string of the url for the layer to pull

sf_object

An sf object used for the bounding box

bbox

Character string of the bounding box

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)

export_type

Character. Either "map" or "image" for the respective service layer desired

add_legend

Logical. Pull legend and match to color values (TRUE, default) or not (FALSE)

...

Additional arguments to pass to the ArcGIS REST API

Value

An object of type RasterLayer if export_type = "map" or an object of type RasterStack if export_type = "image"