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,
  bbox_crs = 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

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)

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 SpatRaster