Retrieve an image service layer from an ArcGIS REST API
get_image_layer.Rd
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,
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
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. Settingclip_raster
to TRUE (default) will remove these usingmask
from theraster
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.
Examples
if (FALSE) {
wi_leaf_off_layer <- get_image_layer(wi_leaf_off_url, wis_poly)
plot_layer(wi_leaf_off_layer, outline_poly = wis_poly)
}